CancelAll button
This commit is contained in:
@@ -60,4 +60,5 @@ export const vaultAbi = [
|
|||||||
'function placeOrder((address,address,(uint8,uint24),uint256,bool,bool,uint64,(uint16,(uint8,bytes)[])[]))',
|
'function placeOrder((address,address,(uint8,uint24),uint256,bool,bool,uint64,(uint16,(uint8,bytes)[])[]))',
|
||||||
'function placeOrders((address,address,(uint8,uint24),uint256,bool,bool,uint64,(uint16,(uint8,bytes)[])[])[],uint8)',
|
'function placeOrders((address,address,(uint8,uint24),uint256,bool,bool,uint64,(uint16,(uint8,bytes)[])[])[],uint8)',
|
||||||
'function cancelOrder(uint64)',
|
'function cancelOrder(uint64)',
|
||||||
|
'function cancelAll()',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -184,6 +184,16 @@ export async function cancelOrder(vault, orderIndex) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function cancelAll(vault) {
|
||||||
|
pendTransaction(async (signer)=> {
|
||||||
|
const contract = contractOrNull(vault, vaultAbi, signer)
|
||||||
|
if( contract === null ) {
|
||||||
|
console.error('vault contract was null while canceling order', vault)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return await contract.cancelAll()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function flushOrders(vault) {
|
export function flushOrders(vault) {
|
||||||
for( const order of pendingOrders )
|
for( const order of pendingOrders )
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<phone-card title="Orders">
|
<phone-card title="Orders">
|
||||||
<v-card-item>
|
<v-card-item>
|
||||||
<btn icon="mdi-plus" color="green" class="mb-6" @click="$router.push('/twap')">New Dexorder</btn>
|
<btn icon="mdi-plus" color="green" class="mb-6" @click="$router.push('/twap')">New Dexorder</btn>
|
||||||
|
<btn icon="mdi-delete-alert" color="red" class="mb-6" @click="cancelAll(vaultAddr)">Cancel All Orders</btn>
|
||||||
<orders/>
|
<orders/>
|
||||||
</v-card-item>
|
</v-card-item>
|
||||||
</phone-card>
|
</phone-card>
|
||||||
@@ -17,6 +18,12 @@ import NeedsSigner from "@/components/NeedsSigner.vue";
|
|||||||
import NeedsProvider from "@/components/NeedsProvider.vue";
|
import NeedsProvider from "@/components/NeedsProvider.vue";
|
||||||
import Btn from "@/components/Btn.vue";
|
import Btn from "@/components/Btn.vue";
|
||||||
import PhoneCard from "@/components/PhoneCard.vue";
|
import PhoneCard from "@/components/PhoneCard.vue";
|
||||||
|
import {cancelAll} from "@/blockchain/wallet.js";
|
||||||
|
import {useStore} from "@/store/store";
|
||||||
|
import {computed} from "vue";
|
||||||
|
const s = useStore()
|
||||||
|
const props = defineProps(['vault'])
|
||||||
|
const vaultAddr = computed(()=>props.vault?props.vault:s.vault)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user