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

@@ -1,6 +1,7 @@
// Utilities
import { defineStore } from 'pinia'
import {knownTokens} from "@/knownTokens.js";
import {computed, ref} from "vue";
let rawProvider = null
let rawProviderChainId = null
@@ -26,6 +27,13 @@ export const useStore = defineStore('app', {
poolPrices: {},
vaultBalances: {}, // indexed by vault addr then by token addr. value is an int
orders: {}, // indexed by vault, value is another dictionary with orderIndex as key and order status values
// Order Input Forms
tokenA: null,
tokenB: null,
routes: [],
routesPending: false,
inverted: false,
}),
getters: {
vault: (s)=>s.vaults.length===0 ? null : s.vaults[0],
@@ -47,6 +55,16 @@ export const useStore = defineStore('app', {
helper: (s)=>!s.chain?null:s.chain.helper,
mockenv: (s)=>!s.chain?null:s.chain.mockenv,
mockCoins: (s)=>!s.chain?[]:!s.chain.mockCoins?[]:s.chain.mockCoins,
route: (s)=>s.routes.length===0 ? null : s.routes[0],
pairSymbol: (s)=>s.base?.symbol+'\\'+s.quote?.symbol,
base: (s)=>{
const token = s.inverted ? s.tokenB : s.tokenA
return !token?{}:token
},
quote: (s)=> {
const token = s.inverted ? s.tokenA : s.tokenB
return !token ? {} : token
},
},
actions: {
removeTransactionSender(sender) {