Skip to content
Merged
Show file tree
Hide file tree
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
23 changes: 17 additions & 6 deletions sdk/src/driftClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7253,6 +7253,9 @@ export class DriftClient {
if (orderParamsMessage.maxMarginRatio === undefined) {
orderParamsMessage.maxMarginRatio = null;
}
if (orderParamsMessage.isolatedPositionDeposit === undefined) {
orderParamsMessage.isolatedPositionDeposit = null;
}

const anchorIxName = delegateSigner
? 'global' + ':' + 'SignedMsgOrderParamsDelegateMessage'
Expand Down Expand Up @@ -7355,12 +7358,6 @@ export class DriftClient {
precedingIxs: TransactionInstruction[] = [],
overrideCustomIxIndex?: number
): Promise<TransactionInstruction[]> {
const remainingAccounts = this.getRemainingAccounts({
userAccounts: [takerInfo.takerUserAccount],
useMarketLastSlotCache: false,
readablePerpMarketIndex: marketIndex,
});

const isDelegateSigner = takerInfo.signingAuthority.equals(
takerInfo.takerUserAccount.delegate
);
Expand All @@ -7374,6 +7371,20 @@ export class DriftClient {
borshBuf,
isDelegateSigner
);

const writableSpotMarketIndexes = signedMessage.isolatedPositionDeposit?.gt(
ZERO
)
? [QUOTE_SPOT_MARKET_INDEX]
: undefined;

const remainingAccounts = this.getRemainingAccounts({
userAccounts: [takerInfo.takerUserAccount],
useMarketLastSlotCache: false,
readablePerpMarketIndex: marketIndex,
writableSpotMarketIndexes,
});

if (isUpdateHighLeverageMode(signedMessage.signedMsgOrderParams.bitFlags)) {
remainingAccounts.push({
pubkey: getHighLeverageModeConfigPublicKey(this.program.programId),
Expand Down
12 changes: 12 additions & 0 deletions sdk/src/idl/drift.json
Original file line number Diff line number Diff line change
Expand Up @@ -10334,6 +10334,12 @@
"type": {
"option": "u16"
}
},
{
"name": "isolatedPositionDeposit",
"type": {
"option": "u64"
}
}
]
}
Expand Down Expand Up @@ -10399,6 +10405,12 @@
"type": {
"option": "u16"
}
},
{
"name": "isolatedPositionDeposit",
"type": {
"option": "u64"
}
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,7 @@ export type SignedMsgOrderParamsMessage = {
maxMarginRatio?: number | null;
builderIdx?: number | null;
builderFeeTenthBps?: number | null;
isolatedPositionDeposit?: BN | null;
};

export type SignedMsgOrderParamsDelegateMessage = {
Expand All @@ -1349,6 +1350,7 @@ export type SignedMsgOrderParamsDelegateMessage = {
maxMarginRatio?: number | null;
builderIdx?: number | null;
builderFeeTenthBps?: number | null;
isolatedPositionDeposit?: BN | null;
};

export type SignedMsgTriggerOrderParams = {
Expand Down
Loading