Skip to main content
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;
}