order placement works, including automatic vault creation
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import {io} from "socket.io-client";
|
||||
import {useStore} from "@/store/store.js";
|
||||
import {onChainChanged} from "@/blockchain/wallet.js";
|
||||
import {ethers} from "ethers";
|
||||
|
||||
export const socket = io(import.meta.env.VITE_WS_URL || undefined, { transports: ["websocket"] })
|
||||
|
||||
@@ -11,11 +13,14 @@ socket.on('disconnect', ()=>{
|
||||
console.log('ws disconnected')
|
||||
})
|
||||
|
||||
socket.on('welcome', (data)=>{
|
||||
socket.on('welcome', async (data)=>{
|
||||
console.log('welcome',data)
|
||||
const s = useStore()
|
||||
s.chainInfo = data.chainInfo
|
||||
s.vaultInitCodeHash = data.vaultInitCodeHash
|
||||
const p = new ethers.BrowserProvider(window.ethereum)
|
||||
const network = await p.getNetwork()
|
||||
if( network !== null )
|
||||
onChainChanged(network.chainId)
|
||||
})
|
||||
|
||||
socket.on('chainInfo', async (chainInfo)=>{
|
||||
const s = useStore()
|
||||
s.chainInfo = chainInfo
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user