概述
LI.FI 组件 v3 对其核心进行了全面改革,增强了与流行账户管理库(如 Wagmi 和 RainbowKit)的兼容性,并整合了许多新功能,包括从 Solana 开始的多生态系统支持。因此,有一些破坏性更改和弃用需要注意,如本指南中概述的。此外,我们鼓励您阅读更新的文档,其中包含此处未提及的新功能。 要开始使用,请安装最新版本的组件。配置
重命名的变体
以下组件变体被重命名以更好地反映其功能:default
现在是 compact
expandable
现在是 wide
有关更多详细信息,请参见选择组件变体。
更新的 toAddress 类型
在组件 v3 中,我们更新了目标钱包功能,包括钱包书签、最近使用的地址等。以前,toAddress
选项的类型是 string
。为了在 v3 中扩展功能,我们为此字段添加了特定类型。
Updated subvariantOptions type
In Widget v3 we extended the functionality of subvariants andsubvariantOptions
required type update. Previously, subvariantOptions
supported only split
subvariant and had SplitSubvariantOptions
type and now we added support for custom
subvariant with possibly more subvariant options coming 中 future.
SDK configuration
Following the release of LI.FI SDK v3 there are some changes to SDK configuration 中 widget.SDKConfig
type is now WidgetSDKConfig
.
defaultRouteOptions
renamed to routeOptions
.
Removed pre-built drawer button
Previously in Widget v2 there were two ways of controlling the drawer. The first one was pre-built button which came with drawer variant to open and close it. The second one was hiding the button viahiddenUI
option and controlling the drawer by attaches the ref. Since the title and positioning often required some adjustments we decided to remove pre-built drawer button in favor of controlling the drawer with external button.
Here is the example of controlling the drawer with ref and you can customize the button as you like.
HiddenUI.DrawerButton
option since there is no default button anymore. However, we added a new option HiddenUI.DrawerCloseButton
to hide the close button inside the drawer.
Theming
In Widget v3, we revamped customization and theming possibilities and did a small cleanup. The top-levelcontainerStyle
option is moved under the umbrella of the theme
option and was renamed to container
.
theme
option type was renamed from ThemeConfig
to WidgetTheme
.
Please check out more in 自定义组件 section.
Miscellaneous
disableLanguageDetector
configuration option was removed. Language detection should now be inherited from the integration dApp.
钱包管理
Moved from Ethers.js to Wagmi
We dropped support for Ethers.js. Instead, Widget now has a first-class Wagmi and all Wagmi-based libraries support like RainbowKit. You can still use Ethers.js in your project and convert Signer/Provider object to use Wagmi’s injected connector before wrapping the Widget with WagmiProvider. However, we suggest moving your dApp’s wallet management to use Wagmi as a more future proof solution.Widget v2 setup with Ethers.js
Widget v3 setup with Wagmi
No more complicated callbacks, just wrap the Widget inWagmiProvider
and you are set. If you already have one in your dApp, just make sure to keep the Wagmi chains configuration in sync with the Widget chain list, so all functionality like switching chains can keep working.
See 钱包管理 for more details.
Updated wallet management configuration
Since we don’t need to provide callbacks and signers to widget configuration,walletManagement
option was renamed to walletConfig
and now has the following interface:
Dependencies
Wagmi is a new peer dependency
Since we moved fromethers.js
to Wagmi
we added it to our peer dependencies.