DCABuilder slippage parameter fix
This commit is contained in:
@@ -75,8 +75,11 @@ function changeAccounts(chainId, accounts) {
|
||||
console.log('account logged in', addr)
|
||||
store.account = addr
|
||||
store.vaults = []
|
||||
discoverVaults(addr)
|
||||
flushTransactions()
|
||||
// one of these two methods will call flushTransactions()
|
||||
if (useWalletStore().transaction!==null)
|
||||
ensureVault()
|
||||
else
|
||||
discoverVaults(addr)
|
||||
socket.emit('address', chainId, addr)
|
||||
}
|
||||
}
|
||||
@@ -215,6 +218,7 @@ async function _discoverVaults(owner) {
|
||||
return // do not change what was already found todo is this correct?
|
||||
}
|
||||
}
|
||||
console.log('new account === owner?', s.account, owner)
|
||||
if( s.account === owner ) { // double-check the account since it could have changed during our await
|
||||
s.vaults = result
|
||||
s.vaultVersions = versions
|
||||
@@ -291,6 +295,7 @@ export async function cancelAll(vault) {
|
||||
|
||||
export function flushOrders(chainId, owner, num, vault) {
|
||||
const ws = useWalletStore();
|
||||
console.log('flushOrders', ws.transaction)
|
||||
if (ws.transaction!==null && ws.transaction.state < TransactionState.Proposed)
|
||||
ws.transaction.propose(owner, vault)
|
||||
let needsFlush = false
|
||||
@@ -376,6 +381,22 @@ export function flushTransactions() {
|
||||
|
||||
async function asyncFlushTransactions() {
|
||||
const s = useStore()
|
||||
const ws = useWalletStore()
|
||||
console.log('flushTransactions', ws.transaction, s.vault)
|
||||
if (ws.transaction !== null) {
|
||||
if (s.vault === null) {
|
||||
await ensureVault()
|
||||
if (s.vault === null) {
|
||||
console.error('vault could not be created')
|
||||
const tx = ws.transaction
|
||||
if (tx) {
|
||||
tx.state = TransactionState.Error
|
||||
ws.transaction = null
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if( provider === null ) {
|
||||
console.log('warning: asyncFlushOrders() cancelled due to null provider')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user