extracted PairChoice component

This commit is contained in:
Tim Olson
2023-11-22 16:35:15 -04:00
parent c69f3c7f54
commit c3f05deff1
5 changed files with 155 additions and 119 deletions

View File

@@ -3,6 +3,7 @@ import {useStore} from "@/store/store.js";
import {flushOrders, onChainChanged} from "@/blockchain/wallet.js";
import {ethers} from "ethers";
import {applyFills} from "@/blockchain/common.js";
import {ref} from "vue";
export const socket = io(import.meta.env.VITE_WS_URL || undefined, {transports: ["websocket"]})
@@ -23,6 +24,11 @@ socket.on('welcome', async (data) => {
const s = useStore()
s.chainInfo = data.chainInfo
s.vaultInitCodeHash = data.vaultInitCodeHash
// set default tokens in pair choice dropdown
if( s.tokenA === null && Object.values(s.tokens).length >= 1 )
s.tokenA = Object.values(s.tokens)[0]
if( s.tokenB === null && Object.values(s.tokens).length >= 2 )
s.tokenB = Object.values(s.tokens)[1]
const p = new ethers.BrowserProvider(window.ethereum)
const network = await p.getNetwork()
if (network !== null)