Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show id of order and tx hash when posting the discrete order #169

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/domain/polling/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ async function _processConditionalOrder(
): Promise<PollResult> {
const { provider, orderBookApi, dryRun, chainId } = context;
const { handler } = conditionalOrder.params;

const log = getLogger(
"checkForAndPlaceOrder:_processConditionalOrder",
orderRef
Expand Down Expand Up @@ -412,6 +413,7 @@ async function _processConditionalOrder(
if (!conditionalOrder.orders.has(orderUid)) {
// Place order
const placeOrderResult = await _placeOrder({
conditionalOrder,
orderUid,
order: { ...orderToSubmit, from: owner, signature },
orderBookApi,
Expand Down Expand Up @@ -500,6 +502,7 @@ export const _printUnfilledOrders = (orders: Map<BytesLike, OrderStatus>) => {
* @param apiUrl rest api url
*/
async function _placeOrder(params: {
conditionalOrder: ConditionalOrder;
orderUid: string;
order: any;
orderBookApi: OrderBookApi;
Expand All @@ -509,6 +512,7 @@ async function _placeOrder(params: {
metricLabels: string[];
}): Promise<Omit<PollResultSuccess, "order" | "signature"> | PollResultErrors> {
const {
conditionalOrder,
orderUid,
order,
orderBookApi,
Expand All @@ -518,7 +522,6 @@ async function _placeOrder(params: {
metricLabels,
} = params;
const log = getLogger("checkForAndPlaceOrder:_placeOrder", orderRef);
const { chainId } = orderBookApi.context;
try {
const postOrder: OrderCreation = {
kind: order.kind,
Expand All @@ -539,7 +542,9 @@ async function _placeOrder(params: {
};

// If the operation is a dry run, don't post to the API
log.info(`Post order ${orderUid} to OrderBook on chain ${chainId}`);
log.info(
`Post order ${orderUid} (ID=${conditionalOrder.id}, TX=${conditionalOrder.tx})`
);
log.debug(`Post order ${orderUid} details`, postOrder);
if (!dryRun) {
const orderUid = await orderBookApi.sendOrder(postOrder);
Expand Down
Loading