Skip to content

Commit c0e48a1

Browse files
committed
feat: coalesce undefined into null for swift iso deposit param
1 parent e1b5ec8 commit c0e48a1

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
@@ -7253,6 +7253,9 @@ export class DriftClient {
72537253
if (orderParamsMessage.maxMarginRatio === undefined) {
72547254
orderParamsMessage.maxMarginRatio = null;
72557255
}
7256+
if (orderParamsMessage.isolatedPositionDeposit === undefined) {
7257+
orderParamsMessage.isolatedPositionDeposit = null;
7258+
}
72567259

72577260
const anchorIxName = delegateSigner
72587261
? 'global' + ':' + 'SignedMsgOrderParamsDelegateMessage'
@@ -7368,16 +7371,18 @@ export class DriftClient {
73687371
borshBuf,
73697372
isDelegateSigner
73707373
);
7374+
7375+
const writableSpotMarketIndexes = signedMessage.isolatedPositionDeposit?.gt(
7376+
new BN(0)
7377+
)
7378+
? [QUOTE_SPOT_MARKET_INDEX]
7379+
: undefined;
73717380

73727381
const remainingAccounts = this.getRemainingAccounts({
73737382
userAccounts: [takerInfo.takerUserAccount],
73747383
useMarketLastSlotCache: false,
73757384
readablePerpMarketIndex: marketIndex,
7376-
writableSpotMarketIndexes: signedMessage.isolatedPositionDeposit?.gt(
7377-
new BN(0)
7378-
)
7379-
? [QUOTE_SPOT_MARKET_INDEX]
7380-
: undefined,
7385+
writableSpotMarketIndexes,
73817386
});
73827387

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

0 commit comments

Comments
 (0)