跳转到主要内容
LI.FI 组件 提供了一个 useWidgetEvents 钩子,让您可以订阅一系列组件事件,并帮助您获取有关执行路由、跟踪桥接和交换进度、跟踪链和代币选择、与特定 UI 元素交互等有用信息。 我们继续致力于扩展可用事件,如果您对特定事件感兴趣,请通过我们的支持联系我们。 为了最小化不必要的重新渲染并防止主组件组件中的潜在故障,请在集成主 LiFiWidget 的组件外部集成 useWidgetEvents 钩子。 如何订阅组件事件的示例:

List of events

Here is the list of all available events: AvailableRoutes
  • Type: Route[]
The event fires when available routes are returned after the user has selected source and destination tokens, entered an amount, and requested the routes. RouteSelected
  • Type: RouteSelected
The event fires when the user selects a specific route from the list of available routes. RouteExecutionStarted
  • Type: Route
The event fires when the user clicks on the Start swapping or Start bridging button. RouteExecutionUpdated
  • Type: RouteExecutionUpdate
The event fires when there is an update to the Route object during execution. RouteExecutionCompleted
  • Type: Route
The event fires when the execution is completed successfully. RouteExecutionFailed
  • Type: RouteExecutionUpdate
The event fires when the execution has failed. RouteHighValueLoss
  • Type: RouteHighValueLossUpdate
The event fires when the High Value Loss bottom sheet appears on the screen. ContactSupport
  • Type: ContactSupport
The event fires when the user clicks on the Contact support button on the Transaction Details page. SourceChainTokenSelected
  • Type: ChainTokenSelected
The event fires when the user selects the source chain and token. DestinationChainTokenSelected
  • Type: ChainTokenSelected
The event fires when the user selects the destination chain and token. SendToWalletToggled
  • Type: boolean
The event fires when the user clicks on the wallet icon next to the action button on the main page to show/hide the destination wallet selection UI. WalletConnected
  • Type: WalletConnected
The event fires when the user connects the wallet via the internal wallet management UI. WidgetExpanded
  • Type: boolean
The event fires when the side panel with routes is shown to the user. Only available 中 wide widget variant. PageEntered
  • Type: NavigationRouteType
The event fires when the user navigates to a page 中 widget. FormFieldChanged
  • Type: FormFieldChanged
The event fires whenever a form value is changed 中 widget. SettingUpdated
  • Type: SettingUpdated
The event fires whenever a setting is updated 中 widget. TokenSearch
  • Type: TokenSearch
The event fires when the user searches for a token (includes the query value and the matched token results). LowAddressActivityConfirmed
  • Type: LowAddressActivityConfirmed
The event fires when the user confirms proceeding despite a low address activity warning for the specified address and chain. ChainPinned
  • Type: ChainPinned
The event fires when the user pins or unpins a chain 中 UI. Routes: Some of the events here present information about routes. A route is the LI.FI way of presenting a quote on an exchange/transfer. A route is a collection of steps, transactions and costs associated with that transfer. In the Widget we present a set of routes that the user can select from. Once selected the execution of that route can begin and the user will be guided through the steps required to complete that route. The route events above can help track a route status.

组件事件 types

Properties and types of the useWidgetEvents hook.