Skip to content

Commit a9658e6

Browse files
authored
feat: update getPlaceSignedMsgTakerPerpOrderIxs for iso position deposit (#1976)
* feat: update getPlaceSignedMsgTakerPerpOrderIxs for iso position deposit * fix: prettier * feat: trim down idl diff to only iso deposit fields * feat: coalesce undefined into null for swift iso deposit param * fix: formatting + cleanup
1 parent 2eedeac commit a9658e6

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

sdk/src/driftClient.ts

Lines changed: 17 additions & 6 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'
@@ -7355,12 +7358,6 @@ export class DriftClient {
73557358
precedingIxs: TransactionInstruction[] = [],
73567359
overrideCustomIxIndex?: number
73577360
): Promise<TransactionInstruction[]> {
7358-
const remainingAccounts = this.getRemainingAccounts({
7359-
userAccounts: [takerInfo.takerUserAccount],
7360-
useMarketLastSlotCache: false,
7361-
readablePerpMarketIndex: marketIndex,
7362-
});
7363-
73647361
const isDelegateSigner = takerInfo.signingAuthority.equals(
73657362
takerInfo.takerUserAccount.delegate
73667363
);
@@ -7374,6 +7371,20 @@ export class DriftClient {
73747371
borshBuf,
73757372
isDelegateSigner
73767373
);
7374+
7375+
const writableSpotMarketIndexes = signedMessage.isolatedPositionDeposit?.gt(
7376+
ZERO
7377+
)
7378+
? [QUOTE_SPOT_MARKET_INDEX]
7379+
: undefined;
7380+
7381+
const remainingAccounts = this.getRemainingAccounts({
7382+
userAccounts: [takerInfo.takerUserAccount],
7383+
useMarketLastSlotCache: false,
7384+
readablePerpMarketIndex: marketIndex,
7385+
writableSpotMarketIndexes,
7386+
});
7387+
73777388
if (isUpdateHighLeverageMode(signedMessage.signedMsgOrderParams.bitFlags)) {
73787389
remainingAccounts.push({
73797390
pubkey: getHighLeverageModeConfigPublicKey(this.program.programId),

sdk/src/idl/drift.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10334,6 +10334,12 @@
1033410334
"type": {
1033510335
"option": "u16"
1033610336
}
10337+
},
10338+
{
10339+
"name": "isolatedPositionDeposit",
10340+
"type": {
10341+
"option": "u64"
10342+
}
1033710343
}
1033810344
]
1033910345
}
@@ -10399,6 +10405,12 @@
1039910405
"type": {
1040010406
"option": "u16"
1040110407
}
10408+
},
10409+
{
10410+
"name": "isolatedPositionDeposit",
10411+
"type": {
10412+
"option": "u64"
10413+
}
1040210414
}
1040310415
]
1040410416
}

sdk/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,7 @@ export type SignedMsgOrderParamsMessage = {
13371337
maxMarginRatio?: number | null;
13381338
builderIdx?: number | null;
13391339
builderFeeTenthBps?: number | null;
1340+
isolatedPositionDeposit?: BN | null;
13401341
};
13411342

13421343
export type SignedMsgOrderParamsDelegateMessage = {
@@ -1349,6 +1350,7 @@ export type SignedMsgOrderParamsDelegateMessage = {
13491350
maxMarginRatio?: number | null;
13501351
builderIdx?: number | null;
13511352
builderFeeTenthBps?: number | null;
1353+
isolatedPositionDeposit?: BN | null;
13521354
};
13531355

13541356
export type SignedMsgTriggerOrderParams = {

0 commit comments

Comments
 (0)