Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.layerswap.io/llms.txt

Use this file to discover all available pages before exploring further.

The onFormChange event fires whenever the user modifies the swap form — for example, when changing the asset, amount, or destination network.
import { CallbackProvider } from "@/context/CallbackContext"

<LayerswapProvider
  callbacks={{
    onFormChange: (formData) => {
      console.log("Form updated:", formData)
    },
  }}
>
  <Swap />
</LayerswapProvider>

Callback Argument Value

formData: {
  from: string;
  to: string;
  fromAsset: string;
  toAsset: string;
  amount: string;
  destination_address: string;
  refuel?: boolean;
}