Comments (10)
@chybisov Thank you so much for taking care of this for me。I have updated to the latest installation package and the problem has been solved。 🙏
from widget.
@vic-x could you please provide a reproducible example/screen recording/more detailed steps to reproduce?
from widget.
@vic-x您能否提供可重现的示例/屏幕录像/更详细的重现步骤?
cf176f6e764a080c8e9bb26c8e39e872_0_1682585552.mp4
from widget.
Vue3 configures walletManagement. When clicking 'swap', the chain selected by the wallet is different from the chain selected by the current exchange. Switch the chain first, and an error will be reported after the operation is successful.
![]()
walletManagement: { connect: async () => { connectWallet() }, disconnect: disconnect, switchChain: async chainId => { await SwitchNetwork({ chainId: chainId }) }, addToken: addToken, addChain: addChain, signer: Signer }
@vic-x thanks for the video! Closely reviewing your code example I noticed you don't return Signer
object from switchChain
function. If you take a look at the types it's required to return Promise<Signer>
:
export interface WidgetWalletManagement {
connect(): Promise<Signer>;
disconnect(): Promise<void>;
switchChain?(chainId: number): Promise<Signer>;
addToken?(token: StaticToken, chainId: number): Promise<void>;
addChain?(chainId: number): Promise<boolean>;
signer?: Signer;
}
Try changing your code example to:
walletManagement: {
connect: async () => {
return connectWallet()
},
disconnect: disconnect,
switchChain: async chainId => {
return SwitchNetwork({
chainId: chainId
})
},
addToken: addToken,
addChain: addChain,
signer: Signer
}
from widget.
Vue3 配置钱包管理。点击“切换”时,钱包选择的链与当前交易所选择的链不同。先切换链,运行成功后会报错。
walletManagement: { connect: async () => { connectWallet() }, disconnect: 断开连接, switchChain: async chainId => { await SwitchNetwork({ chainId: chainId }) }, addToken: addToken, addChain: addChain, signer: Signer }@vic-x感谢视频!仔细查看您的代码示例,我注意到您没有
Signer
从函数返回对象switchChain
。如果您查看需要返回的类型Promise<Signer>
:export interface WidgetWalletManagement { connect(): Promise<Signer>; disconnect(): Promise<void>; switchChain?(chainId: number): Promise<Signer>; addToken?(token: StaticToken, chainId: number): Promise<void>; addChain?(chainId: number): Promise<boolean>; signer?: Signer; }尝试将您的代码示例更改为:
walletManagement: { connect: async () => { return connectWallet() }, disconnect: disconnect, switchChain: async chainId => { return SwitchNetwork({ chainId: chainId }) }, addToken: addToken, addChain: addChain, signer: Signer }
@chybisov Thank you for your reply, but I still have problems after I modified it. I use @wagmi/core to link wallets, switch chains, and get Signer;
The following is the modified code
walletManagement: {
connect: async () => {
connectWallet(connector, chainId.value)
const Signer = await fetchSigner()
return markRaw(Signer)
},
disconnect: disconnect,
switchChain: async chainId => {
await SwitchNetwork({
chainId: chainId
})
const Signer = await fetchSigner({ chainId: chainId })
return markRaw(Signer)
},
addToken: addToken,
addChain: addChain,
signer: markRaw(Signer)
},
from widget.
@vic-x hard to say from this code example what went wrong, it looks fine. Can you please share a reproducible example so I can debug it?
from widget.
@vic-x hard to say from this code example what went wrong, it looks fine. Can you please share a reproducible example so I can debug it?
@chybisov
I wrote a demo, you can view it at https://github.com/vic-x/lifi-demo
from widget.
@vic-x thank you for the demo. We will investigate it and come back to you 🙂
from widget.
from widget.
@vic-x It took a while to figure out, but the fix is released in v2.0.0-beta.10.
from widget.
Related Issues (20)
- The widget crashes in my React v18 app - interpolating a keyframe declaration (iSKUCl) into an untagged string HOT 8
- Web App crash in production HOT 4
- SVG error on page reload HOT 1
- How to update or completely destroy or re-initialize the widget context config ?! HOT 3
- The Widget Provider is lowercasing the passed fromToken and toToken addresses internally HOT 2
- Enabled Bridges showing swap form HOT 2
- Expandable on Vitejs react is not working HOT 2
- Hello, are there any examples used in nuxt3? HOT 6
- Support for the experimental syntax 'importAttributes' isn't currently enabled (1:28) HOT 3
- When applying border radius we have MUI styling on Chrome (See picture) HOT 3
- When chain list size is 10, widget will show a +1 button when is not needed HOT 1
- Drawer variant does not have an option to style the absolute button positioning HOT 2
- Next.js 14 incompatibility issue - OpenSea Seaport missing HOT 6
- Compilation error with wagmi v2 in Next.js HOT 9
- Widget doesn't work (broken endpoints) HOT 2
- v3 does not recognize a connected wallet and is unable to connect one HOT 2
- Can not build in Next.js 14 HOT 6
- Can not compile in Next.js HOT 8
- No swaps on Fantom works in Widget 3.0.0 HOT 2
- fuse network have no routes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from widget.