pending order view bugfix
This commit is contained in:
@@ -266,17 +266,17 @@ const ensureVaultRoutine = new SingletonCoroutine(doEnsureVault, 100)
|
|||||||
|
|
||||||
|
|
||||||
export const PendingOrderState = {
|
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
|
Signing: 0, // tx is sent to the wallet
|
||||||
Rejected: 101, // user refused to sign the tx
|
Rejected: -101, // user refused to sign the tx
|
||||||
Sent: 102, // tx is awaiting blockchain mining
|
Sent: -102, // tx is awaiting blockchain mining
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function pendOrder(order) {
|
export async function pendOrder(order) {
|
||||||
console.log('order', JSON.stringify(order))
|
console.log('order', JSON.stringify(order))
|
||||||
const s = useStore()
|
const s = useStore()
|
||||||
useWalletStore().pendingOrders.push({
|
useWalletStore().pendingOrders.splice(0,0,{
|
||||||
chainId: s.chainId,
|
chainId: s.chainId,
|
||||||
placementTime: Date.now()/1000,
|
placementTime: Date.now()/1000,
|
||||||
vault: s.vaults.length ? s.vaults[0] : null,
|
vault: s.vaults.length ? s.vaults[0] : null,
|
||||||
|
|||||||
@@ -85,10 +85,14 @@
|
|||||||
<tr v-for="(t, i) in item.order.tranches">
|
<tr v-for="(t, i) in item.order.tranches">
|
||||||
<td class="text-right">Tranche {{ i + 1 }}</td>
|
<td class="text-right">Tranche {{ i + 1 }}</td>
|
||||||
<td class="text-center w-33">
|
<td class="text-center w-33">
|
||||||
<suspense>
|
<suspense v-if="item.state > OrderState.Signing">
|
||||||
<span>
|
<span>
|
||||||
<token-amount :addr="item.amountToken" :amount="item.trancheFilled[i]" :raw="true"/>
|
<token-amount :addr="item.amountToken" :amount="item.trancheFilled[i]" :raw="true"/>
|
||||||
/
|
/
|
||||||
|
</span>
|
||||||
|
</suspense>
|
||||||
|
<suspense>
|
||||||
|
<span>
|
||||||
<token-amount :addr="item.amountToken" :amount="item.order.amount*BigInt(t.fraction)/65535n"/>
|
<token-amount :addr="item.amountToken" :amount="item.order.amount*BigInt(t.fraction)/65535n"/>
|
||||||
</span>
|
</span>
|
||||||
</suspense>
|
</suspense>
|
||||||
@@ -202,11 +206,12 @@ const orders = computed(()=>{
|
|||||||
// in-flight orders
|
// in-flight orders
|
||||||
for (const pend of ws.pendingOrders) {
|
for (const pend of ws.pendingOrders) {
|
||||||
console.log('pended order', pend)
|
console.log('pended order', pend)
|
||||||
result.splice(0, 0, {
|
result.push({
|
||||||
start: pend.placementTime,
|
start: pend.placementTime,
|
||||||
order: pend.order,
|
order: pend.order,
|
||||||
filled: 0,
|
filled: 0,
|
||||||
state: pend.state
|
state: pend.state,
|
||||||
|
amountToken: pend.order.amountIsInput ? pend.order.tokenIn : pend.order.tokenOut
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user