diff --git a/sdk/src/driftClient.ts b/sdk/src/driftClient.ts index 87681bf13..fd464aa32 100644 --- a/sdk/src/driftClient.ts +++ b/sdk/src/driftClient.ts @@ -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' @@ -7355,12 +7358,6 @@ export class DriftClient { precedingIxs: TransactionInstruction[] = [], overrideCustomIxIndex?: number ): Promise { - const remainingAccounts = this.getRemainingAccounts({ - userAccounts: [takerInfo.takerUserAccount], - useMarketLastSlotCache: false, - readablePerpMarketIndex: marketIndex, - }); - const isDelegateSigner = takerInfo.signingAuthority.equals( takerInfo.takerUserAccount.delegate ); @@ -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), diff --git a/sdk/src/idl/drift.json b/sdk/src/idl/drift.json index ed9c2538a..a358214ea 100644 --- a/sdk/src/idl/drift.json +++ b/sdk/src/idl/drift.json @@ -10334,6 +10334,12 @@ "type": { "option": "u16" } + }, + { + "name": "isolatedPositionDeposit", + "type": { + "option": "u64" + } } ] } @@ -10399,6 +10405,12 @@ "type": { "option": "u16" } + }, + { + "name": "isolatedPositionDeposit", + "type": { + "option": "u64" + } } ] } diff --git a/sdk/src/types.ts b/sdk/src/types.ts index e2801414e..42ddce507 100644 --- a/sdk/src/types.ts +++ b/sdk/src/types.ts @@ -1337,6 +1337,7 @@ export type SignedMsgOrderParamsMessage = { maxMarginRatio?: number | null; builderIdx?: number | null; builderFeeTenthBps?: number | null; + isolatedPositionDeposit?: BN | null; }; export type SignedMsgOrderParamsDelegateMessage = { @@ -1349,6 +1350,7 @@ export type SignedMsgOrderParamsDelegateMessage = { maxMarginRatio?: number | null; builderIdx?: number | null; builderFeeTenthBps?: number | null; + isolatedPositionDeposit?: BN | null; }; export type SignedMsgTriggerOrderParams = {