Skip to content

Commit c3e2bc5

Browse files
committed
placeAndMake respect builder codes
1 parent fee9d7f commit c3e2bc5

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

sdk/src/driftClient.ts

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6648,15 +6648,6 @@ export class DriftClient {
66486648
});
66496649
}
66506650

6651-
remainingAccounts.push({
6652-
pubkey: getRevenueShareEscrowAccountPublicKey(
6653-
this.program.programId,
6654-
this.getUserAccount(subAccountId).authority
6655-
),
6656-
isWritable: true,
6657-
isSigner: false,
6658-
});
6659-
66606651
let optionalParams = null;
66616652
if (auctionDurationPercentage || successCondition) {
66626653
optionalParams =
@@ -6746,6 +6737,16 @@ export class DriftClient {
67466737
});
67476738

67486739
const takerOrderId = takerInfo.order.orderId;
6740+
if (hasBuilder(takerInfo.order)) {
6741+
remainingAccounts.push({
6742+
pubkey: getRevenueShareEscrowAccountPublicKey(
6743+
this.program.programId,
6744+
takerInfo.takerUserAccount.authority
6745+
),
6746+
isWritable: true,
6747+
isSigner: false,
6748+
});
6749+
}
67496750
return await this.program.instruction.placeAndMakePerpOrder(
67506751
orderParams,
67516752
takerOrderId,
@@ -7096,6 +7097,32 @@ export class DriftClient {
70967097
});
70977098
}
70987099

7100+
const isDelegateSigner = takerInfo.signingAuthority.equals(
7101+
takerInfo.takerUserAccount.delegate
7102+
);
7103+
const borshBuf = Buffer.from(
7104+
signedSignedMsgOrderParams.orderParams.toString(),
7105+
'hex'
7106+
);
7107+
7108+
const signedMessage = this.decodeSignedMsgOrderParamsMessage(
7109+
borshBuf,
7110+
isDelegateSigner
7111+
);
7112+
if (
7113+
signedMessage.builderFeeTenthBps !== null &&
7114+
signedMessage.builderIdx !== null
7115+
) {
7116+
remainingAccounts.push({
7117+
pubkey: getRevenueShareEscrowAccountPublicKey(
7118+
this.program.programId,
7119+
takerInfo.takerUserAccount.authority
7120+
),
7121+
isWritable: true,
7122+
isSigner: false,
7123+
});
7124+
}
7125+
70997126
const placeAndMakeIx =
71007127
await this.program.instruction.placeAndMakeSignedMsgPerpOrder(
71017128
orderParams,

0 commit comments

Comments
 (0)