From be9fe609b00e8c65af2b648919b82d02eb62bca1 Mon Sep 17 00:00:00 2001 From: lowkeynicc Date: Wed, 15 Nov 2023 16:06:09 -0500 Subject: [PATCH 1/2] sdk: fix modify order bug going from auction to non-auction --- CHANGELOG.md | 1 + sdk/src/driftClient.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 300ed72f1..f1673adac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - program: add add update_liquidation_margin_buffer_ratio ([#695](https://github.com/drift-labs/protocol-v2/pull/695)) - program: account for fee pool when settling positive pnl ([#687](https://github.com/drift-labs/protocol-v2/pull/687)) - sdk: fix bug which incorrectly calculated leverage after trade for a market with no position but short orders open +- sdk: fix bug in modifying an order that previously had auction params to a non-auction order ### Breaking diff --git a/sdk/src/driftClient.ts b/sdk/src/driftClient.ts index 60a10b685..98255971b 100644 --- a/sdk/src/driftClient.ts +++ b/sdk/src/driftClient.ts @@ -4649,12 +4649,12 @@ export class DriftClient { oraclePriceOffset: newOraclePriceOffset || null, triggerPrice: newTriggerPrice || null, triggerCondition: newTriggerCondition || null, - auctionDuration: auctionDuration || null, - auctionStartPrice: auctionStartPrice || null, - auctionEndPrice: auctionEndPrice || null, - reduceOnly: reduceOnly || null, - postOnly: postOnly || null, - immediateOrCancel: immediateOrCancel || null, + auctionDuration: auctionDuration || 0, + auctionStartPrice: auctionStartPrice || ZERO, + auctionEndPrice: auctionEndPrice || ZERO, + reduceOnly: reduceOnly || false, + postOnly: postOnly || false, + immediateOrCancel: immediateOrCancel || false, policy: policy || null, maxTs: maxTs || null, }; From c9b8e09c6280c96c1ce3965b2d7b50b573941714 Mon Sep 17 00:00:00 2001 From: lowkeynicc Date: Wed, 15 Nov 2023 16:24:40 -0500 Subject: [PATCH 2/2] use null for postonly --- sdk/src/driftClient.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/src/driftClient.ts b/sdk/src/driftClient.ts index 98255971b..b3443d47c 100644 --- a/sdk/src/driftClient.ts +++ b/sdk/src/driftClient.ts @@ -4653,7 +4653,7 @@ export class DriftClient { auctionStartPrice: auctionStartPrice || ZERO, auctionEndPrice: auctionEndPrice || ZERO, reduceOnly: reduceOnly || false, - postOnly: postOnly || false, + postOnly: postOnly || null, immediateOrCancel: immediateOrCancel || false, policy: policy || null, maxTs: maxTs || null, @@ -4767,12 +4767,12 @@ export class DriftClient { oraclePriceOffset: newOraclePriceOffset || null, triggerPrice: newTriggerPrice || null, triggerCondition: newTriggerCondition || null, - auctionDuration: auctionDuration || null, - auctionStartPrice: auctionStartPrice || null, - auctionEndPrice: auctionEndPrice || null, - reduceOnly: reduceOnly || null, + auctionDuration: auctionDuration || 0, + auctionStartPrice: auctionStartPrice || ZERO, + auctionEndPrice: auctionEndPrice || ZERO, + reduceOnly: reduceOnly || false, postOnly: postOnly || null, - immediateOrCancel: immediateOrCancel || null, + immediateOrCancel: immediateOrCancel || false, policy: policy || null, maxTs: maxTs || null, };