js: add estimateFillDuration query

This commit is contained in:
Pierre de La Morinerie 2022-05-17 15:49:53 +02:00
parent 6596ea0bab
commit 3bd637fc56

View file

@ -52,8 +52,20 @@ export function updateTypeDeChampOperation(
handleResponseData(typeDeChamp, data as ResponseData);
});
}
export function estimateFillDuration(queue: OperationsQueue): Promise<number> {
return queue
.enqueue({
path: `/estimate_fill_duration`,
method: 'get'
})
.then((data) => {
const responseData = data as EstimatedFillDurationResponseData;
return responseData.estimated_fill_duration;
});
}
type ResponseData = { type_de_champ: Record<string, string> };
type EstimatedFillDurationResponseData = { estimated_fill_duration: number };
function handleResponseData(
typeDeChamp: Partial<TypeDeChamp>,