@bulletxyz/bullet-sdk 0.24.0-rc.9 → 0.25.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { Connection } from "./connection";
4
4
  import { type Endpoints } from "./constants";
5
5
  import { ExchangeConnection } from "./exchange";
6
6
  import type { RuntimeCall } from "./rollupTypes";
7
- import { type Address, type Asset, type MarkPriceUpdateArgs, type Market, type Network, type OraclePriceUpdateArgs, type PlaceOrderArgs, type TokenId, type TpslOrder } from "./types";
7
+ import { type Address, type Asset, type MarkPriceUpdateArgs, type Market, type Network, type OraclePriceUpdateArgs, type PlaceOrderArgs, type PlacePositionTpslArgs, type TokenId } from "./types";
8
8
  import type { Wallet } from "./wallet";
9
9
  export interface TransactionOpts {
10
10
  maxPriorityFeeBps: number;
@@ -62,7 +62,26 @@ export declare class Client {
62
62
  filled_size: Decimal;
63
63
  average_filled_price: Decimal;
64
64
  owner: string;
65
- tpsl_order_ids: bigint[];
65
+ pending_tpsl: {
66
+ tp: {
67
+ tpsl_order_id: bigint;
68
+ order_price: Decimal;
69
+ trigger_price: Decimal;
70
+ trigger_direction: "GreaterThanOrEqual" | "LessThanOrEqual";
71
+ price_condition: "Mark" | "Oracle" | "LastTrade";
72
+ dynamic_size: boolean;
73
+ order_type: "Limit" | "PostOnly" | "FillOrKill" | "ImmediateOrCancel" | "PostOnlySlide" | "PostOnlyFront";
74
+ } | null;
75
+ sl: {
76
+ tpsl_order_id: bigint;
77
+ order_price: Decimal;
78
+ trigger_price: Decimal;
79
+ trigger_direction: "GreaterThanOrEqual" | "LessThanOrEqual";
80
+ price_condition: "Mark" | "Oracle" | "LastTrade";
81
+ dynamic_size: boolean;
82
+ order_type: "Limit" | "PostOnly" | "FillOrKill" | "ImmediateOrCancel" | "PostOnlySlide" | "PostOnlyFront";
83
+ } | null;
84
+ };
66
85
  }>;
67
86
  position: {
68
87
  size: Decimal;
@@ -75,20 +94,17 @@ export declare class Client {
75
94
  };
76
95
  user_selected_max_leverage: number;
77
96
  tpsls: Map<bigint, {
78
- side: "Bid" | "Ask";
79
- market_id: number;
80
- owner: string;
97
+ size: Decimal;
81
98
  tpsl_order_id: bigint;
82
99
  order_price: Decimal;
83
100
  trigger_price: Decimal;
84
101
  trigger_direction: "GreaterThanOrEqual" | "LessThanOrEqual";
85
- tpsl_price_condition: "Mark" | "Oracle" | "LastTrade";
86
- active_size: Decimal;
87
- full_size: Decimal;
102
+ price_condition: "Mark" | "Oracle" | "LastTrade";
88
103
  order_type: "Limit" | "PostOnly" | "FillOrKill" | "ImmediateOrCancel" | "PostOnlySlide" | "PostOnlyFront";
89
- parent_order_id: bigint | null;
90
- linked_tpsl_order_ids: bigint[];
91
- is_executable: boolean;
104
+ side: "Bid" | "Ask";
105
+ market_id: number;
106
+ owner: string;
107
+ linked_tpsl_order_id: bigint | null;
92
108
  }>;
93
109
  }>;
94
110
  }>;
@@ -98,9 +114,9 @@ export declare class Client {
98
114
  deposit(asset: Asset, amount: Decimal): Promise<TransactionResult<Transaction<RuntimeCall>>>;
99
115
  withdraw(asset: Asset, amount: Decimal): Promise<TransactionResult<Transaction<RuntimeCall>>>;
100
116
  borrowSpot(asset: Asset, amount: Decimal): Promise<TransactionResult<Transaction<RuntimeCall>>>;
101
- placeOrder(placeOrderArgs: PlaceOrderArgs, tpslOrders?: TpslOrder[]): Promise<TransactionResult<Transaction<RuntimeCall>>>;
102
- placeTpslsForMarket(market: Market, tpslOrders: TpslOrder[]): Promise<TransactionResult<Transaction<RuntimeCall>>>;
103
- replaceOrder(existingOrderId: bigint, placeOrderArgs: PlaceOrderArgs, tpslOrders?: TpslOrder[]): Promise<TransactionResult<Transaction<RuntimeCall>>>;
117
+ placeOrder(placeOrderArgs: PlaceOrderArgs): Promise<TransactionResult<Transaction<RuntimeCall>>>;
118
+ placeTpslsForMarket(market: Market, tpslOrders: PlacePositionTpslArgs): Promise<TransactionResult<Transaction<RuntimeCall>>>;
119
+ replaceOrder(existingOrderId: bigint | null, existingClientOrderId: bigint | null, placeOrderArgs: PlaceOrderArgs): Promise<TransactionResult<Transaction<RuntimeCall>>>;
104
120
  cancelTpsl(tpslOrderId: bigint): Promise<TransactionResult<Transaction<RuntimeCall>>>;
105
121
  cancelOrder(orderId: bigint): Promise<TransactionResult<Transaction<RuntimeCall>>>;
106
122
  cancelAllOrdersForMarket(market: Market): Promise<TransactionResult<Transaction<RuntimeCall>>>;
@@ -1,4 +1,4 @@
1
- import type { Address, AssetId, MarketId, OrderId, TokenId } from "./types";
1
+ import type { Address, AssetId, MarketId, TokenId } from "./types";
2
2
  type ExactlyOne<T, Keys extends keyof T = keyof T> = {
3
3
  [K in Keys]: {
4
4
  [P in K]: T[P];
@@ -22,14 +22,23 @@ type BankCallMessage = {
22
22
  };
23
23
  };
24
24
  };
25
- type Tpsl = {
25
+ type TriggerOrderArgs = {
26
26
  order_price: number;
27
27
  trigger_price: number;
28
28
  trigger_direction: string;
29
- tpsl_price_condition: string;
30
- size: number;
29
+ price_condition: string;
31
30
  order_type: string;
32
31
  };
32
+ type PendingTriggerOrderArgs = {
33
+ pending_tp: TriggerOrderArgs | null;
34
+ pending_sl: TriggerOrderArgs | null;
35
+ dynamic_size: boolean;
36
+ };
37
+ type PlacePositionTpslArgs = {
38
+ tp: TriggerOrderArgs | null;
39
+ sl: TriggerOrderArgs | null;
40
+ size: number | null;
41
+ };
33
42
  type ExchangeCallMessage = {
34
43
  set_value: number;
35
44
  deposit: {
@@ -52,16 +61,17 @@ type ExchangeCallMessage = {
52
61
  side: string;
53
62
  order_type: string;
54
63
  reduce_only: boolean;
55
- tpsl_orders_ids: OrderId[] | null;
64
+ client_order_id: string | null;
65
+ tpsl: PendingTriggerOrderArgs | null;
56
66
  };
57
- tpsls: Tpsl[];
58
67
  };
59
68
  place_tpsls_for_market: {
60
69
  market_id: MarketId;
61
- tpsls: Tpsl[];
70
+ tpsls: PlacePositionTpslArgs;
62
71
  };
63
72
  replace_order: {
64
- existing_order_id: string;
73
+ existing_order_id: string | null;
74
+ existing_client_order_id: string | null;
65
75
  order_args: {
66
76
  market_id: MarketId;
67
77
  price: number;
@@ -69,9 +79,9 @@ type ExchangeCallMessage = {
69
79
  side: string;
70
80
  order_type: string;
71
81
  reduce_only: boolean;
72
- tpsl_orders_ids: OrderId[] | null;
82
+ client_order_id: string | null;
83
+ tpsl: PendingTriggerOrderArgs | null;
73
84
  };
74
- tpsls: Tpsl[];
75
85
  };
76
86
  cancel_tpsl: {
77
87
  tpsl_order_id: string;
@@ -6,6 +6,7 @@ export type TokenId = string;
6
6
  export type AssetId = number;
7
7
  export type MarketId = number;
8
8
  export type OrderId = number;
9
+ export type ClientOrderId = bigint;
9
10
  export declare enum Asset {
10
11
  USDC = 0,
11
12
  SOL = 1,
@@ -58,6 +59,8 @@ export type PlaceOrderArgs = {
58
59
  side: Side;
59
60
  orderType: OrderType;
60
61
  reduceOnly: boolean;
62
+ clientOrderId: ClientOrderId | null;
63
+ tpsl: PendingTriggerOrderArgs | null;
61
64
  };
62
65
  export type OraclePriceUpdateArgs = {
63
66
  assetId: AssetId;
@@ -68,14 +71,23 @@ export type MarkPriceUpdateArgs = {
68
71
  medianCexPrice: Decimal;
69
72
  diffEma: Decimal;
70
73
  };
71
- export type TpslOrder = {
74
+ export type TriggerOrderArgs = {
72
75
  orderPrice: Decimal;
73
76
  triggerPrice: Decimal;
74
77
  triggerDirection: TriggerDirection;
75
- tpslPriceCondition: TpslPriceCondition;
76
- size: Decimal;
78
+ priceCondition: TpslPriceCondition;
77
79
  orderType: OrderType;
78
80
  };
81
+ export type PendingTriggerOrderArgs = {
82
+ pendingTp: TriggerOrderArgs | null;
83
+ pendingSl: TriggerOrderArgs | null;
84
+ dynamicSize: boolean;
85
+ };
86
+ export type PlacePositionTpslArgs = {
87
+ tp: TriggerOrderArgs | null;
88
+ sl: TriggerOrderArgs | null;
89
+ size: Decimal | null;
90
+ };
79
91
  export declare class BulletError extends Error {
80
92
  originalError?: Error | undefined;
81
93
  code: string;
@@ -10,6 +10,7 @@ export declare const Base58Address: z.ZodString;
10
10
  export declare const AssetId: z.ZodNumber;
11
11
  export declare const MarketId: z.ZodNumber;
12
12
  export declare const OrderId: z.ZodBigInt;
13
+ export declare const TpslOrderId: z.ZodBigInt;
13
14
  export declare const Amount: z.ZodBigInt;
14
15
  export declare const UnixTimestampMillis: z.ZodBigInt;
15
16
  type MapKeySchema = z.ZodString | z.ZodNumber | z.ZodUnknown | z.ZodBigInt;