order cancels

This commit is contained in:
Tim Olson
2023-11-10 16:42:44 -04:00
parent 72e6333152
commit 85a17cf7a9
6 changed files with 34 additions and 11 deletions

View File

@@ -157,6 +157,18 @@ export async function pendOrder(order) {
}
export async function cancelOrder(vault, orderIndex) {
pendTransaction(async (signer)=> {
const contract = contractOrNull(vault, vaultAbi, signer)
if( contract === null ) {
console.error('vault contract was null while canceling order', vault, orderIndex)
return null
}
return await contract.cancelOrder(orderIndex)
})
}
export function flushOrders(vault) {
for( const order of pendingOrders )
pendOrderAsTransaction(vault, order)