welcome dialog; order UI facelift
This commit is contained in:
@@ -619,3 +619,26 @@ export async function addNetwork(chainId) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function addNetworkAndConnectWallet(chainId) {
|
||||
try {
|
||||
await switchChain(chainId)
|
||||
} catch (e) {
|
||||
if (e.code === 4001) {
|
||||
// explicit user rejection
|
||||
return
|
||||
} else if (e.code === 4902) {
|
||||
try {
|
||||
await addNetwork(chainId)
|
||||
} catch (e) {
|
||||
console.log(`Could not add network ${chainId}`)
|
||||
}
|
||||
} else
|
||||
console.log('switchChain() failure', e)
|
||||
}
|
||||
try {
|
||||
await connectWallet(chainId)
|
||||
} catch (e) {
|
||||
if (e.code !== 4001)
|
||||
console.log('connectWallet() failed', e)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user