Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump sdks #403

Merged
merged 1 commit into from
Mar 1, 2025
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "lib/index.js",
"license": "Apache-2.0",
"dependencies": {
"@drift-labs/jit-proxy": "0.13.51",
"@drift-labs/sdk": "2.112.0-beta.7",
"@drift-labs/jit-proxy": "0.13.54",
"@drift-labs/sdk": "2.112.0-beta.10",
"@opentelemetry/api": "1.7.0",
"@opentelemetry/auto-instrumentations-node": "0.31.2",
"@opentelemetry/exporter-prometheus": "0.31.0",
Expand Down
6 changes: 5 additions & 1 deletion src/experimental-bots/fastlane/makerExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import WebSocket from 'ws';
import nacl from 'tweetnacl';
import { decodeUTF8 } from 'tweetnacl-util';
import { simulateAndGetTxWithCUs } from '../../utils';
import { ComputeBudgetProgram, Keypair, TransactionInstruction } from '@solana/web3.js';
import {
ComputeBudgetProgram,
Keypair,
TransactionInstruction,
} from '@solana/web3.js';
import { getPriorityFeeInstruction } from '../filler-common/utils';

export class FastlaneMaker {
Expand Down
46 changes: 28 additions & 18 deletions src/experimental-bots/filler-common/dlobBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ import {
getUserAccountPublicKey,
SignedMsgOrderNode,
Order,
OrderType,
getAuctionPrice,
ZERO,
OrderTriggerCondition,
PositionDirection,
UserStatus,
isUserProtectedMaker,
OraclePriceData,
StateAccount,
OrderStatus,
} from '@drift-labs/sdk';
import { Connection, PublicKey } from '@solana/web3.js';
import dotenv from 'dotenv';
Expand Down Expand Up @@ -199,6 +198,21 @@ class DLOBBuilder {
}: SignedMsgOrderParamsMessage = this.driftClient.decodeSignedMsgOrderParamsMessage(
Buffer.from(orderData['order_message'], 'hex')
);

if (
!signedMsgOrderParams.auctionDuration ||
!signedMsgOrderParams.auctionStartPrice ||
!signedMsgOrderParams.auctionEndPrice ||
signedMsgOrderParams.auctionStartPrice.eq(ZERO) ||
signedMsgOrderParams.auctionEndPrice.eq(ZERO)
) {
return;
}

if (signedMsgOrderParams.baseAssetAmount.eq(ZERO)) {
return;
}

logger.info(
`Received signedMsgOrder: ${JSON.stringify(signedMsgOrderParams)}`
);
Expand All @@ -223,41 +237,37 @@ class DLOBBuilder {
}

const orderSlot = Math.min(slot.toNumber(), this.slotSubscriber.getSlot());

const signedMsgOrder: Order = {
status: 'open',
orderType: OrderType.MARKET,
status: OrderStatus.OPEN,
orderType: signedMsgOrderParams.orderType,
orderId: uuid,
slot: new BN(orderSlot),
marketIndex: signedMsgOrderParams.marketIndex,
marketType: MarketType.PERP,
baseAssetAmount: signedMsgOrderParams.baseAssetAmount,
auctionDuration: signedMsgOrderParams.auctionDuration!,
auctionStartPrice: signedMsgOrderParams.auctionStartPrice!,
auctionEndPrice: signedMsgOrderParams.auctionEndPrice!,
immediateOrCancel: true,
auctionDuration: signedMsgOrderParams.auctionDuration,
auctionStartPrice: signedMsgOrderParams.auctionStartPrice,
auctionEndPrice: signedMsgOrderParams.auctionEndPrice,
immediateOrCancel: signedMsgOrderParams.immediateOrCancel ?? false,
direction: signedMsgOrderParams.direction,
postOnly: false,
oraclePriceOffset: signedMsgOrderParams.oraclePriceOffset ?? 0,
maxTs: signedMsgOrderParams.maxTs ?? ZERO,
reduceOnly: signedMsgOrderParams.reduceOnly ?? false,
triggerCondition:
signedMsgOrderParams.triggerCondition ?? OrderTriggerCondition.ABOVE,
price: signedMsgOrderParams.price ?? ZERO,
userOrderId: signedMsgOrderParams.userOrderId ?? 0,
// Rest are not required for DLOB
triggerPrice: ZERO,
triggerCondition: OrderTriggerCondition.ABOVE,
// Rest are not necessary and set for type conforming
existingPositionDirection: PositionDirection.LONG,
reduceOnly: false,
triggerPrice: ZERO,
baseAssetAmountFilled: ZERO,
quoteAssetAmountFilled: ZERO,
quoteAssetAmount: ZERO,
bitFlags: 0,
postedSlotTail: 0,
};
signedMsgOrder.price = getAuctionPrice(
signedMsgOrder,
this.slotSubscriber.getSlot(),
this.driftClient.getOracleDataForPerpMarket(signedMsgOrder.marketIndex)
.price
);

const signedMsgOrderNode = new SignedMsgOrderNode(
signedMsgOrder,
Expand Down
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -175,25 +175,25 @@
enabled "2.0.x"
kuler "^2.0.0"

"@drift-labs/[email protected].51":
version "0.13.51"
resolved "https://registry.yarnpkg.com/@drift-labs/jit-proxy/-/jit-proxy-0.13.51.tgz#3053974101169594dbd8abf1a8f080d13830e85b"
integrity sha512-MHgE/DAN3vbpxfZ7HmjWlEa2L1Iqmz+lF/GGw5WaKiVDovSBZFIeVKo55stnhZHLAKMwe3XrX3RenT8BPpVDHQ==
"@drift-labs/[email protected].54":
version "0.13.54"
resolved "https://registry.yarnpkg.com/@drift-labs/jit-proxy/-/jit-proxy-0.13.54.tgz#49c4285a7dbd07e571c7d7fee1afdc586f864ce5"
integrity sha512-eTo0uLodVXyY7sMQZXnUNcfi0nVdioKUN7XBuBL8Q5yCm/yCM9OR2Ix+F1an/ULYjcaYH6zCsf+nC3I1A9AgeA==
dependencies:
"@coral-xyz/anchor" "0.26.0"
"@drift-labs/sdk" "2.112.0-beta.7"
"@drift-labs/sdk" "2.112.0-beta.10"
"@solana/web3.js" "1.91.7"
tweetnacl-util "^0.15.1"

"@drift-labs/[email protected].7":
version "2.112.0-beta.7"
resolved "https://registry.yarnpkg.com/@drift-labs/sdk/-/sdk-2.112.0-beta.7.tgz#dcc3f05f11e22683ee07c87e0d40e6057f7998fd"
integrity sha512-soj6ugDQ3D4DXP+E9eThIjhhBiSCRxCafXnZBZp5nA1T8wQjomtdxFceMWxIHH2dytLguZ4SWU9Ms+4BnKMd3w==
"@drift-labs/[email protected].10":
version "2.112.0-beta.10"
resolved "https://registry.yarnpkg.com/@drift-labs/sdk/-/sdk-2.112.0-beta.10.tgz#ed5b5db322377a86a81fce40132bd0a6bb87e165"
integrity sha512-fHqIlL4mZMsGTBEK81L7NlTMgu4WHGU+65NgMp1gxgCOr5iZaBir4n5Zig6Vhojilcj0Hk2AJy30xjdVqVJevg==
dependencies:
"@coral-xyz/anchor" "0.29.0"
"@coral-xyz/anchor-30" "npm:@coral-xyz/[email protected]"
"@ellipsis-labs/phoenix-sdk" "1.4.5"
"@grpc/grpc-js" "^1.8.0"
"@grpc/grpc-js" "1.12.2"
"@openbook-dex/openbook-v2" "0.2.10"
"@project-serum/serum" "0.13.65"
"@pythnetwork/client" "2.5.3"
Expand Down Expand Up @@ -388,7 +388,7 @@
resolved "https://registry.yarnpkg.com/@fastify/error/-/error-2.0.0.tgz#a9f94af56eb934f0ab1ce4ef9f0ced6ebf2319dc"
integrity sha512-wI3fpfDT0t7p8E6dA2eTECzzOd+bZsZCJ2Hcv+Onn2b7ZwK3RwD27uW2QDaMtQhAfWQQP+WNK7nKf0twLsBf9w==

"@grpc/grpc-js@^1.8.0":
"@grpc/grpc-js@1.12.2", "@grpc/grpc-js@^1.8.0":
version "1.12.2"
resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.12.2.tgz#97eda82dd49bb9c24eaf6434ea8d7de446e95aac"
integrity sha512-bgxdZmgTrJZX50OjyVwz3+mNEnCTNkh3cIqGPWVNeW9jX6bn1ZkU80uPd+67/ZpIJIjRQ9qaHCjhavyoWYxumg==
Expand Down