vault fixes; order total fill reactivity fix; provider fix
This commit is contained in:
@@ -28,6 +28,8 @@ import Btn from "@/components/Btn.vue";
|
||||
import {socket} from "@/socket.js";
|
||||
import {metadata} from "@/version.js";
|
||||
|
||||
const DISABLED_DURATION = 60_000;
|
||||
|
||||
const props = defineProps({
|
||||
text: {default:'GIB!'},
|
||||
})
|
||||
@@ -78,7 +80,7 @@ function gib() {
|
||||
if (Object.keys(tokenAmounts).length>0) {
|
||||
disabled.value = true
|
||||
socket.emit('gib', s.chainId, s.account, s.vault, tokenAmounts )
|
||||
setTimeout(()=>disabled.value=false, 60_000)
|
||||
setTimeout(()=>disabled.value=false, DISABLED_DURATION)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,20 +14,15 @@ let lastValue = props.touch
|
||||
|
||||
function pulse() {
|
||||
if (props.touch === lastValue) return
|
||||
console.log(`value changed from ${lastValue} to ${props.touch}`)
|
||||
lastValue = props.touch
|
||||
const e = element.value;
|
||||
console.log('element', e)
|
||||
if (!e.classList.contains('pulse')) {
|
||||
// add class for the first time
|
||||
console.log('first pulse')
|
||||
e.classList.add('pulse')
|
||||
}
|
||||
else {
|
||||
// restart
|
||||
console.log('reset pulse')
|
||||
e.getAnimations().forEach((a) => {
|
||||
console.log('animation', a)
|
||||
a.cancel();
|
||||
a.play();
|
||||
})
|
||||
|
||||
@@ -4,29 +4,37 @@
|
||||
item-selectable="selectable" :show-select="false" :show-expand="true">
|
||||
<template v-slot:item.start="{ value }">{{ dateString(value) }}</template>
|
||||
<template v-slot:item.input="{ item }">
|
||||
<suspense>
|
||||
<span v-if="item.order.amountIsInput">
|
||||
<pulse :touch="item.filledIn">
|
||||
<token-amount :addr="item.order.tokenIn" :amount="item.filledIn" :raw="true"/>
|
||||
</pulse>
|
||||
<span v-if="item.order.amountIsInput">
|
||||
<span v-if="item.state > OrderState.Signing">
|
||||
<suspense>
|
||||
<pulse :touch="item.filledIn">
|
||||
<token-amount :chain-id="item.chainId" :addr="item.order.tokenIn" :amount="item.filledIn" :raw="true"/>
|
||||
</pulse>
|
||||
</suspense>
|
||||
/
|
||||
<token-amount :addr="item.order.tokenIn" :amount="item.order.amount"/>
|
||||
</span>
|
||||
</suspense>
|
||||
<suspense>
|
||||
<token-amount :chain-id="item.chainId" :addr="item.order.tokenIn" :amount="item.order.amount"/>
|
||||
</suspense>
|
||||
</span>
|
||||
<suspense>
|
||||
<token-symbol :addr="item.order.tokenIn" v-if="!item.order.amountIsInput"/>
|
||||
</suspense>
|
||||
</template>
|
||||
<template v-slot:item.output="{ item }">
|
||||
<suspense>
|
||||
<span v-if="!item.order.amountIsInput">
|
||||
<pulse :touch="item.filledOut">
|
||||
<token-amount :addr="item.order.tokenOut" :amount="item.filledOut" :raw="true"/>
|
||||
</pulse>
|
||||
<span v-if="!item.order.amountIsInput">
|
||||
<span v-if="item.state > OrderState.Signing">
|
||||
<suspense>
|
||||
<pulse :touch="item.filledOut">
|
||||
<token-amount :chain-id="item.chainId" :addr="item.order.tokenOut" :amount="item.filledOut" :raw="true"/>
|
||||
</pulse>
|
||||
</suspense>
|
||||
/
|
||||
<token-amount :addr="item.order.tokenOut" :amount="item.order.amount"/>
|
||||
</span>
|
||||
</suspense>
|
||||
<suspense>
|
||||
<token-amount :chain-id="item.chainId" :addr="item.order.tokenOut" :amount="item.order.amount"/>
|
||||
</suspense>
|
||||
</span>
|
||||
<suspense>
|
||||
<token-symbol :addr="item.order.tokenOut" v-if="item.order.amountIsInput"/>
|
||||
</suspense>
|
||||
@@ -94,14 +102,14 @@
|
||||
<suspense>
|
||||
<span v-if="item.state > OrderState.Signing">
|
||||
<pulse :touch="item.trancheFilled[i]">
|
||||
<token-amount :addr="item.amountToken" :amount="item.trancheFilled[i]" :raw="true"/>
|
||||
<token-amount :chain-id="item.chainId" :addr="item.amountToken" :amount="item.trancheFilled[i]" :raw="true"/>
|
||||
</pulse>
|
||||
/
|
||||
</span>
|
||||
</suspense>
|
||||
<suspense>
|
||||
<span>
|
||||
<token-amount :addr="item.amountToken" :amount="item.order.amount*BigInt(t.fraction)/65535n"/>
|
||||
<token-amount :chain-id="item.chainId" :addr="item.amountToken" :amount="item.order.amount*BigInt(t.fraction)/65535n"/>
|
||||
</span>
|
||||
</suspense>
|
||||
</td>
|
||||
@@ -209,6 +217,7 @@ const orders = computed(()=>{
|
||||
for (const pend of ws.pendingOrders) {
|
||||
console.log('pended order', pend)
|
||||
result.push({
|
||||
chainId: pend.chainId,
|
||||
id: pend.id,
|
||||
start: pend.placementTime,
|
||||
order: pend.order,
|
||||
@@ -222,19 +231,23 @@ const orders = computed(()=>{
|
||||
const vault = vaultAddr.value;
|
||||
if( vault in s.orders ) {
|
||||
for (const [index, status] of Object.entries(s.orders[vault]).reverse()) {
|
||||
const st = {...status}
|
||||
const o = {...st.order}
|
||||
// const st = {...status}
|
||||
// const o = {...st.order}
|
||||
const st = status
|
||||
const o = st.order
|
||||
st.order = o
|
||||
console.log('order status', st)
|
||||
result.push(st)
|
||||
st.id = `${vault}|${index}`
|
||||
st.index = parseInt(index)
|
||||
/*
|
||||
o.tranches = o.tranches.map((tranche)=>{
|
||||
const t = {...tranche}
|
||||
// t.startTime = t.startTimeIsRelative ? intervalString(t.startTime) : dateString(t.startTime)
|
||||
// t.endTime = t.endTimeIsRelative ? intervalString(t.endTime) : dateString(t.endTime)
|
||||
return t
|
||||
})
|
||||
*/
|
||||
const fmtX18 = {decimals: 18, width: 256, signed: false};
|
||||
st.filled = o.amountIsInput ? st.filledIn : st.filledOut
|
||||
if(BigInt(st.filled) === 0n)
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {useStore} from "@/store/store";
|
||||
import {getToken} from "@/blockchain/token.js";
|
||||
import {FixedNumber} from "ethers";
|
||||
import {computed} from "vue";
|
||||
|
||||
const s = useStore()
|
||||
const props = defineProps(['addr', 'amount', 'raw'])
|
||||
const token = await getToken(s.chainId, props.addr)
|
||||
const props = defineProps(['chainId', 'addr', 'amount', 'raw'])
|
||||
const token = await getToken(props.chainId, props.addr)
|
||||
const fmtAmount = computed(() => {
|
||||
if( props.amount === null || props.amount === undefined )
|
||||
return ''
|
||||
|
||||
Reference in New Issue
Block a user