From b2a863699684765327e50b3ea577189792cd4aa2 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 28 Mar 2024 15:46:34 -0400 Subject: [PATCH] pending order view bugfix --- src/blockchain/wallet.js | 8 ++++---- src/components/Orders.vue | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/blockchain/wallet.js b/src/blockchain/wallet.js index 0f2ad64..a4f4230 100644 --- a/src/blockchain/wallet.js +++ b/src/blockchain/wallet.js @@ -266,17 +266,17 @@ const ensureVaultRoutine = new SingletonCoroutine(doEnsureVault, 100) export const PendingOrderState = { - Submitted: 100, // user clicked Place Order but the tx isn't sent to the wallet yet + Submitted: -100, // user clicked Place Order but the tx isn't sent to the wallet yet Signing: 0, // tx is sent to the wallet - Rejected: 101, // user refused to sign the tx - Sent: 102, // tx is awaiting blockchain mining + Rejected: -101, // user refused to sign the tx + Sent: -102, // tx is awaiting blockchain mining } export async function pendOrder(order) { console.log('order', JSON.stringify(order)) const s = useStore() - useWalletStore().pendingOrders.push({ + useWalletStore().pendingOrders.splice(0,0,{ chainId: s.chainId, placementTime: Date.now()/1000, vault: s.vaults.length ? s.vaults[0] : null, diff --git a/src/components/Orders.vue b/src/components/Orders.vue index d2e0770..b94e89b 100644 --- a/src/components/Orders.vue +++ b/src/components/Orders.vue @@ -85,12 +85,16 @@ Tranche {{ i + 1 }} + + + + / + + - - - / - - + + + @@ -202,11 +206,12 @@ const orders = computed(()=>{ // in-flight orders for (const pend of ws.pendingOrders) { console.log('pended order', pend) - result.splice(0, 0, { + result.push({ start: pend.placementTime, order: pend.order, filled: 0, - state: pend.state + state: pend.state, + amountToken: pend.order.amountIsInput ? pend.order.tokenIn : pend.order.tokenOut }) }