Skip to content

Commit 51bebe7

Browse files
committed
feat: coalesce undefined into null for swift iso deposit param
1 parent fc2a362 commit 51bebe7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

sdk/src/driftClient.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6953,6 +6953,9 @@ export class DriftClient {
69536953
if (orderParamsMessage.maxMarginRatio === undefined) {
69546954
orderParamsMessage.maxMarginRatio = null;
69556955
}
6956+
if (orderParamsMessage.isolatedPositionDeposit === undefined) {
6957+
orderParamsMessage.isolatedPositionDeposit = null;
6958+
}
69566959

69576960
const anchorIxName = delegateSigner
69586961
? 'global' + ':' + 'SignedMsgOrderParamsDelegateMessage'
@@ -7068,16 +7071,18 @@ export class DriftClient {
70687071
borshBuf,
70697072
isDelegateSigner
70707073
);
7074+
7075+
const writableSpotMarketIndexes = signedMessage.isolatedPositionDeposit?.gt(
7076+
new BN(0)
7077+
)
7078+
? [QUOTE_SPOT_MARKET_INDEX]
7079+
: undefined;
70717080

70727081
const remainingAccounts = this.getRemainingAccounts({
70737082
userAccounts: [takerInfo.takerUserAccount],
70747083
useMarketLastSlotCache: false,
70757084
readablePerpMarketIndex: marketIndex,
7076-
writableSpotMarketIndexes: signedMessage.isolatedPositionDeposit?.gt(
7077-
new BN(0)
7078-
)
7079-
? [QUOTE_SPOT_MARKET_INDEX]
7080-
: undefined,
7085+
writableSpotMarketIndexes,
70817086
});
70827087

70837088
if (isUpdateHighLeverageMode(signedMessage.signedMsgOrderParams.bitFlags)) {

0 commit comments

Comments
 (0)