order placement working

This commit is contained in:
Tim Olson
2023-10-08 01:11:53 -04:00
parent c637e82ac3
commit 24ce025619
3 changed files with 14 additions and 15 deletions

View File

@@ -9,10 +9,15 @@ export function onChainChanged(chainId) {
chainId = Number(chainId)
// console.log('chain changed', chainId)
const store = useStore()
store.chainId = chainId
store.account = null
provider = new ethers.BrowserProvider(window.ethereum, chainId)
provider.listAccounts().then(onAccountsChanged)
if( chainId !== store.chainId ) {
store.chainId = chainId
store.account = null
provider = new ethers.BrowserProvider(window.ethereum, chainId)
provider.listAccounts().then(onAccountsChanged)
new ethers.Interface([
// 'event DexorderSwapCreated' // todo
])
}
}
function onAccountsChanged(accounts) {