<!--
Sitemap:
- [Stridge — The infrastructure bridging crypto payments](/index): Crypto payment infrastructure for modern fintechs. Accept on any chain, settle through the cheapest route, and pay out in any asset — all from a single SDK.
- [API Reference](/api-reference/): Stridge REST API reference — complete endpoint documentation for deposits, payouts, Universal Deposit Addresses, settlements, and supported networks.
- [Changelog](/changelog): Release notes for Stridge SDKs and developer tools.
- [Stridge Gateway Kit](/gateway/): Drop-in deposit and withdraw flows for crypto apps. Mount a single React provider, render a dialog, and ship any-to-any payments in minutes.
- [Getting Started](/getting-started): Get started with Stridge — pick your integration shape, generate keys, and make your first call from the React Kit, the TypeScript SDK, or the REST API.
- [Supported Networks](/networks): Blockchain networks and tokens supported by the Stridge payment infrastructure — network_id (SLIP-44), EIP-155 chain IDs, and the available native and stablecoin assets per chain.
- [TypeScript SDK](/sdk/): TypeScript client for the Stridge Gateway API. Used internally by @stridge/kit and exposed for backend and server integrations that need direct API access.
- [Security](/security/): Stridge Security — how the Stridge KMS protects wallet keys and signs transactions without ever exposing private keys.
- [Universal Deposit Addresses](/uda/): Universal Deposit Addresses (UDA) — one multi-chain deposit address per user, with automatic cross-chain settlement to a fixed destination.
- [Webhooks](/webhooks/): Stridge webhooks — signed HTTP POSTs for deposits, UDA settlements, wallets, and balances. Verify HMAC, handle retries, and use the Dashboard to inspect event payloads.
- [Gateway HTTP API](/gateway/http): Raw HTTP contract for the Stridge Gateway — supported-assets catalogue, gateway/start provisioning, and per-owner status polling.
- [UDA Quickstart](/uda/quickstart): Create your first Universal Deposit Address and trace a deposit end-to-end — from the POST call, through webhooks, to a settled transaction on the destination chain.
- [Settlements](/uda/settlements): UDA settlements — lifecycle, routing scenarios, fees, and the settlement record API. Reconcile deposits with webhooks; the Dashboard shows each settlement end-to-end.
- [UDA Webhook Events](/uda/webhooks): Reference for the three webhook events UDA deposits emit — deposit.confirmed, uda.settlement.created, and uda.settlement.completed — with payloads and lifecycle guidance.
- [Get a single deposit transaction by ID](/api-reference/deposits/get-a-single-deposit-transaction-by-id): Get details of a specific deposit transaction by its unique ID
- [Get a single deposit transaction by transaction id](/api-reference/deposits/get-a-single-deposit-transaction-by-transaction-id): One row per matching tx_id; multiple same-tx transfers are separate rows. Returns the latest by on-chain time (then id). Use GET /v1/deposits with tx_id filter
- [List deposit transactions](/api-reference/deposits/list-deposit-transactions): Get a paginated list of deposit transactions for the authenticated tenant with filtering support
- [Get blockchain assets](/api-reference/networks/get-blockchain-assets): Get a list of all supported blockchain assets (tokens and native assets).
- [Get blockchain networks](/api-reference/networks/get-blockchain-networks): Get a list of all supported blockchain networks.
- [Get network list](/api-reference/networks/get-network-list): Get a public list of all networks with category grouping.
- [Get tenant network](/api-reference/networks/get-tenant-network): Get a specific network for the authenticated tenant by network ID and contract address
- [Get tenant networks](/api-reference/networks/get-tenant-networks): Get a list of networks available to the authenticated tenant with their enabled status
- [Update tenant network status](/api-reference/networks/update-tenant-network-status): Update the enabled status of a network for the authenticated tenant
- [Create payout](/api-reference/payouts/create-payout): Creates a new payout from the tenant's vault wallet to an external address
- [Create payout with USD amount](/api-reference/payouts/create-payout-with-usd-amount): Creates a new payout converting a USD amount to crypto at current rate
- [Get payout by ID](/api-reference/payouts/get-payout-by-id): Retrieves a payout by its ID
- [Get vault address by network](/api-reference/payouts/get-vault-address-by-network): Get the vault address for a specific network
- [Get vault balances](/api-reference/payouts/get-vault-balances): Get balances for all vault addresses with optional filtering
- [Get vault total value](/api-reference/payouts/get-vault-total-value): Get the total USD value across all vault assets
- [List payouts](/api-reference/payouts/list-payouts): Lists payouts for a vault with filtering and pagination
- [List vault addresses](/api-reference/payouts/list-vault-addresses): Get all vault addresses for the authenticated tenant
- [List vaults](/api-reference/payouts/list-vaults): List all vault accounts for the authenticated tenant
- [Transfer from vault to external address](/api-reference/payouts/transfer-from-vault-to-external-address): Transfer assets from the tenant's vault wallet to an external address.
- [Get a settlement](/api-reference/settlements/get-a-settlement): Fetch a single settlement by ID. A settlement is created per confirmed deposit on a UDA address and carries the lifecycle state, scenario, and routing tx ids.
- [Create a UDA address](/api-reference/uda/create-a-uda-address): Allocate a new Universal Deposit Address for the tenant. If a UDA for the (tenant, owner) pair already exists, the existing record is returned with 200 instead
- [Get a cross-chain / cross-token quote](/api-reference/uda/get-a-cross-chain-cross-token-quote): Returns an indicative quote for routing from/to given (chain, token) pair. USD fields are omitted until a price feed is wired in.
- [Get a UDA address](/api-reference/uda/get-a-uda-address): Fetch a single UDA address by ID, including its delegation status.
- [List settlements for a UDA address](/api-reference/uda/list-settlements-for-a-uda-address): List all settlements that have been created for a given UDA address, optionally paginated.
- [List UDA addresses](/api-reference/uda/list-uda-addresses): List UDA addresses belonging to the authenticated tenant. Supports filtering by owner and status and pagination via limit/offset.
- [List UDA-supported chains](/api-reference/uda/list-uda-supported-chains): Returns every chain with `uda_support=true` along with its native currency and configured token contracts. Rows are grouped by network.
- [Retire a UDA address](/api-reference/uda/retire-a-uda-address): Mark a UDA address as retired. Future deposits will no longer trigger settlements; any already-confirmed settlements continue to run to completion.
- [Update a UDA address](/api-reference/uda/update-a-uda-address): Update the destination, accepted tokens, or status of an existing UDA. Owner is immutable.
-->

# Stridge Gateway Kit \[React widgets and headless hooks for any-to-any payments]

The **Stridge Gateway Kit** ([`@stridge/kit`](https://www.npmjs.com/package/@stridge/kit)) is a React component library that turns the Stridge Gateway into a few lines of JSX. Mount `<StridgeProvider />` once, drop in `<DepositDialog />` and `<WithdrawDialog />`, and your users can pay or withdraw across **any supported chain and token** while you settle to a **single asset**.

[**Open the live demo**](https://demo.stridge.com) — a working integration. The [headless demo](https://demo.stridge.com/headless) shows the same flow driven from a custom UI through the kit's hooks.

## What you get

* **Drop-in dialogs** — themed `<DepositDialog />` and `<WithdrawDialog />` covering the entire flow from picker to success state.
* **Headless hooks** — `useDeposit()`, `useDepositState()`, `useWithdraw()` for teams that want to render their own UI.
* **One source of truth for the settlement asset** — `asset={{ chain, symbol }}` configures both flows.
* **Wallet-agnostic** — withdraw runs without `wagmi`. Deposit's wallet-method optionally signs via `wagmi`; QR / address flows work without it.

## Install

```bash
pnpm add @stridge/kit
```

Import the global stylesheet once at your app entry:

```css
@import "@stridge/kit/styles.css";
```

Peer deps: `react ^19`, `react-dom ^19`, `viem >=2.48.1`. Add `wagmi >=3.6.3` only if you enable the deposit wallet method.

## Configure the provider

`<StridgeProvider />` wraps your app. It needs three things: your **gateway key**, the **settlement asset**, and the **flows** you want to enable.

:::info
Find your gateway key in the [Stridge Dashboard](https://beta.dashboard.stridge.com) under **Developer → Gateway Kit → Connection**. The Kit is designed to run client-side, so the public env var pattern below is intended.
:::

### Deposit only

```tsx [app.tsx]
import type { ReactNode } from "react"
import { StridgeProvider } from "@stridge/kit"

export function App({
  children,
  customerAddress,
}: {
  children: ReactNode
  customerAddress: `0x${string}`
}) {
  return (
    <StridgeProvider
      gatewayKey={process.env.NEXT_PUBLIC_STRIDGE_GATEWAY_KEY!}
      asset={{ chain: "bsc", symbol: "USDC" }}
      flows={{
        deposit: {
          // Where bridged funds settle. Use the customer's wallet for
          // same-owner setups, or your treasury / payout address otherwise.
          destination: { address: customerAddress },
        },
      }}
      appearance={{ accent: "oklch(64.51% 0.19 274.49)", radius: "rounded" }}
    >
      {children}
    </StridgeProvider>
  )
}
```

### Withdraw only

```tsx [app.tsx]
import type { ReactNode } from "react"
import { StridgeProvider } from "@stridge/kit"

export function App({
  children,
  customerAddress,
}: {
  children: ReactNode
  customerAddress: `0x${string}`
}) {
  return (
    <StridgeProvider
      gatewayKey={process.env.NEXT_PUBLIC_STRIDGE_GATEWAY_KEY!}
      asset={{ chain: "bsc", symbol: "USDC" }}
      flows={{
        withdraw: {
          // The `gateway/start.owner` the kit scopes settlement polls
          // against. Same-owner setups pass the customer's address here.
          owner: { address: customerAddress },
        },
      }}
      appearance={{ accent: "oklch(64.51% 0.19 274.49)", radius: "rounded" }}
    >
      {children}
    </StridgeProvider>
  )
}
```

Add a sibling key under `flows` to enable both flows on the same provider.

### `asset.chain` accepts three forms

| Form | Example |
| --- | --- |
| Chain slug | `"bsc"`, `"base"`, `"arbitrum"` |
| EIP-155 chain id | `56` |
| Stridge network id | `"9006"` |

Import the typed catalogue from `@stridge/kit` for autocomplete:

```ts
import { chains } from "@stridge/kit"

asset: { chain: chains.bsc, symbol: "USDC" }
```

## Open the deposit dialog

Mount `<DepositDialog />` once anywhere inside the provider, then call `useDeposit().open()` from any descendant.

```tsx [DepositButton.tsx]
"use client"

import { useDeposit } from "@stridge/kit"
import { DepositDialog } from "@stridge/kit/deposit/dialog"

export function DepositButton() {
  const { open } = useDeposit()
  return (
    <>
      <button type="button" onClick={() => open()}>
        Deposit
      </button>
      <DepositDialog />
    </>
  )
}
```

The dialog handles the full flow: chain & token picker, QR + copy, status polling, success and failure screens. Funds settle to the `flows.deposit.destination.address` you configured on the provider.

## Open the withdraw dialog

Withdraw asks **you** to broadcast the source-chain transaction (your wallet, custodial signer, or backend), then advances a state machine the dialog renders.

```tsx [WithdrawButton.tsx]
"use client"

import { useWithdraw } from "@stridge/kit"
import { WithdrawDialog } from "@stridge/kit/withdraw/dialog"

export function WithdrawButton({ balance }: { balance: number | undefined }) {
  const { open } = useWithdraw()
  return (
    <>
      <button type="button" onClick={() => open()}>
        Withdraw
      </button>
      <WithdrawDialog
        // Render-time balance the form displays. Pass undefined while loading.
        balance={balance}
        // Fires when the customer submits. Sign on your side, then advance:
        // actions.beginProcessing(tx?) → in-progress (with or without hash)
        // actions.setTxHash(tx)        → upgrade watcher to tx-anchored
        // actions.fail(failure)        → terminal failure
        // actions.succeed()            → terminal success
        onSubmit={async (input, actions) => {
          try {
            // input.depositTarget — UDA address + chain + token
            // input.correlation.owner — Stridge owner for cross-system logs
            const txHash = await yourBackend.broadcastWithdraw(input.depositTarget)
            actions.beginProcessing({ hash: txHash })
          } catch (err) {
            actions.fail({
              reason: err instanceof Error ? err.message : String(err),
            })
          }
        }}
      />
    </>
  )
}
```

### `onSubmit` actions

| Action | When to call it |
| --- | --- |
| `actions.beginProcessing(tx?)` | After your broadcast call resolves. Pass the hash if you have one. |
| `actions.setTxHash(tx)` | Later, once the hash is known — upgrades the watcher from best-match to tx-anchored. |
| `actions.succeed()` | Optional terminal success; the dialog otherwise resolves once Stridge confirms settlement. |
| `actions.fail(failure)` | Terminal failure with a `reason` string. |

## Theming

`appearance` controls light/dark mode, accent color, and corner radius. Values are forwarded to the kit's design tokens — set them on `<StridgeProvider />` and every dialog inherits them.

```tsx
<StridgeProvider
  appearance={{
    theme: "dark",                       // "light" | "dark" | "system"
    accent: "oklch(78% 0.15 240)",       // any CSS color
    radius: "rounded",                   // "sharp" | "rounded" | "soft"
  }}
  // …
/>
```

## Headless integration

Render your own UI without mounting the dialogs. The kit ships hooks for state, snapshots, and actions on both flows.

```tsx
"use client"

import { useDeposit, useDepositState } from "@stridge/kit"

export function CustomDepositPanel() {
  const state = useDepositState()       // FSM state — "idle" | "in_progress" | …
  const { actions } = useDeposit()      // imperative actions
  // Render your own UI driven by `state`. See the headless demo for a worked
  // example: https://demo.stridge.com/headless
  return null
}
```

The same pattern mirrors for withdraw via `useWithdraw()` and `useWithdrawState()`. The root entry point ships **no UI** when you stay headless, so the bundle stays clean.

## What runs underneath

The Kit talks to the Stridge Gateway over HTTPS using your gateway key. For backends, server-side integrations, or non-React stacks, see:

* [TypeScript SDK](/sdk) — `@stridge/sdk`, the underlying client used by the Kit.
* [Gateway HTTP API](/gateway/http) — raw `gateway/start`, polling, and `supported-assets` contract.
* [API reference](/api-reference) — every Stridge REST endpoint in full detail.

## Next steps

* Try the [live demo](https://demo.stridge.com) and the [headless demo](https://demo.stridge.com/headless).
* Read the underlying [Universal Deposit Address model](/uda) the Gateway settles through.
* Spin up a [gateway key](https://beta.dashboard.stridge.com) in the Dashboard.
