diff --git a/Cargo.lock b/Cargo.lock index b519a35c..9a86bfda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -942,8 +942,8 @@ dependencies = [ [[package]] name = "drift" -version = "2.137.0" -source = "git+https://github.com/drift-labs/protocol-v2.git?tag=v2.137.0#56ff8ee35cccb7d5f501a587dd0248950354bc4b" +version = "2.140.0" +source = "git+https://github.com/drift-labs/protocol-v2.git?tag=v2.140.0#d315d880dd85cc59f10e5f788c8c64d65d52cd76" dependencies = [ "ahash 0.8.6", "anchor-lang", @@ -1656,7 +1656,7 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openbook-v2-light" version = "0.1.0" -source = "git+https://github.com/drift-labs/protocol-v2.git?tag=v2.137.0#56ff8ee35cccb7d5f501a587dd0248950354bc4b" +source = "git+https://github.com/drift-labs/protocol-v2.git?tag=v2.140.0#d315d880dd85cc59f10e5f788c8c64d65d52cd76" dependencies = [ "anchor-lang", "borsh 0.10.3", @@ -2806,7 +2806,7 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "switchboard" version = "0.1.0" -source = "git+https://github.com/drift-labs/protocol-v2.git?tag=v2.137.0#56ff8ee35cccb7d5f501a587dd0248950354bc4b" +source = "git+https://github.com/drift-labs/protocol-v2.git?tag=v2.140.0#d315d880dd85cc59f10e5f788c8c64d65d52cd76" dependencies = [ "anchor-lang", ] @@ -2814,7 +2814,7 @@ dependencies = [ [[package]] name = "switchboard-on-demand" version = "0.1.0" -source = "git+https://github.com/drift-labs/protocol-v2.git?tag=v2.137.0#56ff8ee35cccb7d5f501a587dd0248950354bc4b" +source = "git+https://github.com/drift-labs/protocol-v2.git?tag=v2.140.0#d315d880dd85cc59f10e5f788c8c64d65d52cd76" dependencies = [ "anchor-lang", "bytemuck", diff --git a/programs/jit-proxy/Cargo.toml b/programs/jit-proxy/Cargo.toml index fbd47709..e4cc42f3 100644 --- a/programs/jit-proxy/Cargo.toml +++ b/programs/jit-proxy/Cargo.toml @@ -17,7 +17,7 @@ default = [] anchor-lang = "0.29.0" anchor-spl = "0.29.0" bytemuck = { version = "1.4.0" } -drift = { git = "https://github.com/drift-labs/protocol-v2.git", tag = "v2.137.0", features = ["cpi", "mainnet-beta"]} +drift = { git = "https://github.com/drift-labs/protocol-v2.git", tag = "v2.140.0", features = ["cpi", "mainnet-beta"]} static_assertions = "1.1.0" solana-program = "1.16" ahash = "=0.8.6" diff --git a/ts/sdk/src/jitProxyClient.ts b/ts/sdk/src/jitProxyClient.ts index 318ce1af..f78e35a3 100644 --- a/ts/sdk/src/jitProxyClient.ts +++ b/ts/sdk/src/jitProxyClient.ts @@ -11,6 +11,8 @@ import { SignedMsgOrderParams, TxParams, UserAccount, + hasBuilder, + getRevenueShareEscrowAccountPublicKey, } from '@drift-labs/sdk'; import { IDL, JitProxy } from './types/jit_proxy'; import { @@ -239,6 +241,17 @@ export class JitProxyClient { isWritable: false, isSigner: false, }); + } else { + if (hasBuilder(order)) { + remainingAccounts.push({ + pubkey: getRevenueShareEscrowAccountPublicKey( + this.program.programId, + taker.authority + ), + isWritable: true, + isSigner: false, + }); + } } const jitParams = { @@ -279,6 +292,8 @@ export class JitProxyClient { subAccountId, uuid, marketIndex, + signedMsgOrderParams, + authorityToUse, }: JitSignedMsgIxParams): Promise { subAccountId = subAccountId !== undefined @@ -303,6 +318,30 @@ export class JitProxyClient { }); } + const isDelegateSigner = authorityToUse.equals(taker.delegate); + const borshBuf = Buffer.from( + signedMsgOrderParams.orderParams.toString(), + 'hex' + ); + + const signedMessage = this.driftClient.decodeSignedMsgOrderParamsMessage( + borshBuf, + isDelegateSigner + ); + if ( + signedMessage.builderFeeTenthBps !== null && + signedMessage.builderIdx !== null + ) { + remainingAccounts.push({ + pubkey: getRevenueShareEscrowAccountPublicKey( + this.program.programId, + taker.authority + ), + isWritable: true, + isSigner: false, + }); + } + const jitSignedMsgParams = { signedMsgOrderUuid: Array.from(uuid), maxPosition,