@bulletxyz/bullet-sdk 0.26.1 → 0.26.3-rc.0
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.
- package/dist/browser/index.js +27 -19
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +27 -19
- package/dist/node/index.js.map +2 -2
- package/dist/types/client.d.ts +49 -1
- package/dist/types/exchange.d.ts +16 -16
- package/dist/types/rollupTypes.d.ts +2 -2
- package/dist/types/types.d.ts +0 -1
- package/dist/types/zod-types/rest.d.ts +2061 -287
- package/package.json +1 -1
package/dist/types/client.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export declare class Client {
|
|
|
93
93
|
funding_payments_on_position: Decimal;
|
|
94
94
|
};
|
|
95
95
|
user_selected_max_leverage: number;
|
|
96
|
+
fee_tier: "Tier0" | "Tier1" | "Tier2" | "Tier3" | "Tier4";
|
|
96
97
|
tpsls: Map<bigint, {
|
|
97
98
|
size: Decimal | null;
|
|
98
99
|
tpsl_order_id: bigint;
|
|
@@ -104,9 +105,56 @@ export declare class Client {
|
|
|
104
105
|
side: "Bid" | "Ask";
|
|
105
106
|
market_id: number;
|
|
106
107
|
owner: string;
|
|
108
|
+
last_update_timestamp: bigint;
|
|
107
109
|
linked_tpsl_order_id: bigint | null;
|
|
108
110
|
}>;
|
|
109
111
|
}>;
|
|
112
|
+
spot_orders: Map<number, Map<bigint, {
|
|
113
|
+
side: "Bid" | "Ask";
|
|
114
|
+
market_id: number;
|
|
115
|
+
order_id: bigint;
|
|
116
|
+
price: Decimal;
|
|
117
|
+
remaining_size: Decimal;
|
|
118
|
+
reduce_only: boolean;
|
|
119
|
+
filled_size: Decimal;
|
|
120
|
+
average_filled_price: Decimal;
|
|
121
|
+
owner: string;
|
|
122
|
+
pending_tpsl: {
|
|
123
|
+
tp: {
|
|
124
|
+
tpsl_order_id: bigint;
|
|
125
|
+
order_price: Decimal;
|
|
126
|
+
trigger_price: Decimal;
|
|
127
|
+
trigger_direction: "GreaterThanOrEqual" | "LessThanOrEqual";
|
|
128
|
+
price_condition: "Mark" | "Oracle" | "LastTrade";
|
|
129
|
+
dynamic_size: boolean;
|
|
130
|
+
order_type: "Limit" | "PostOnly" | "FillOrKill" | "ImmediateOrCancel" | "PostOnlySlide" | "PostOnlyFront";
|
|
131
|
+
} | null;
|
|
132
|
+
sl: {
|
|
133
|
+
tpsl_order_id: bigint;
|
|
134
|
+
order_price: Decimal;
|
|
135
|
+
trigger_price: Decimal;
|
|
136
|
+
trigger_direction: "GreaterThanOrEqual" | "LessThanOrEqual";
|
|
137
|
+
price_condition: "Mark" | "Oracle" | "LastTrade";
|
|
138
|
+
dynamic_size: boolean;
|
|
139
|
+
order_type: "Limit" | "PostOnly" | "FillOrKill" | "ImmediateOrCancel" | "PostOnlySlide" | "PostOnlyFront";
|
|
140
|
+
} | null;
|
|
141
|
+
};
|
|
142
|
+
}>>;
|
|
143
|
+
spot_tpsls: Map<number, Map<bigint, {
|
|
144
|
+
size: Decimal | null;
|
|
145
|
+
tpsl_order_id: bigint;
|
|
146
|
+
order_price: Decimal;
|
|
147
|
+
trigger_price: Decimal;
|
|
148
|
+
trigger_direction: "GreaterThanOrEqual" | "LessThanOrEqual";
|
|
149
|
+
price_condition: "Mark" | "Oracle" | "LastTrade";
|
|
150
|
+
order_type: "Limit" | "PostOnly" | "FillOrKill" | "ImmediateOrCancel" | "PostOnlySlide" | "PostOnlyFront";
|
|
151
|
+
side: "Bid" | "Ask";
|
|
152
|
+
market_id: number;
|
|
153
|
+
owner: string;
|
|
154
|
+
last_update_timestamp: bigint;
|
|
155
|
+
linked_tpsl_order_id: bigint | null;
|
|
156
|
+
}>>;
|
|
157
|
+
spot_fee_tiers: Map<number, "Tier0" | "Tier1" | "Tier2" | "Tier3" | "Tier4">;
|
|
110
158
|
}>;
|
|
111
159
|
submitTransaction(runtimeCall: RuntimeCall): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
112
160
|
transfer(to: Address, amount: bigint, tokenId: TokenId): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
@@ -117,7 +165,7 @@ export declare class Client {
|
|
|
117
165
|
placeOrder(placeOrderArgs: PlaceOrderArgs): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
118
166
|
createPositionTpsl(market: MarketName, tpslOrders: PlacePositionTpslArgs): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
119
167
|
amendOrder(options: AmendOrderOptions): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
120
|
-
|
|
168
|
+
cancelTpsls(tpslOrderIds: bigint[]): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
121
169
|
cancelOrder(orderId?: bigint, clientOrderId?: bigint): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
122
170
|
cancelAllOrdersForMarket(market: MarketName): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
123
171
|
updateOraclePrices(pricesToUpdate: OraclePriceUpdateArgs[], publishTimestamp?: number): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
package/dist/types/exchange.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare class ExchangeConnection extends BaseConnection {
|
|
|
44
44
|
getTpslOrderIdsToExecute(market: MarketName): Promise<TpslOrderIdsToExecute | null>;
|
|
45
45
|
getGlobalParameters(): Promise<GlobalParameters | null>;
|
|
46
46
|
calculateOrderbookMidpoint(orderbook: OrderbookL2): Decimal | undefined;
|
|
47
|
-
calculateEntryPrice(market: MarketName, userAccount: UserAccount):
|
|
47
|
+
calculateEntryPrice(market: MarketName, userAccount: UserAccount): Decimal;
|
|
48
48
|
calculateTotalPerpUnrealizedPnl(userAccount: UserAccount, MarginCalculationState: {
|
|
49
49
|
oracle_prices: OraclePrices;
|
|
50
50
|
perp_prices: PerpPrices;
|
|
@@ -79,7 +79,7 @@ export declare class ExchangeConnection extends BaseConnection {
|
|
|
79
79
|
oracle_prices: OraclePrices;
|
|
80
80
|
perp_prices: PerpPrices;
|
|
81
81
|
margin_config: MarginConfig;
|
|
82
|
-
}):
|
|
82
|
+
}): Decimal;
|
|
83
83
|
calculateLiquidationRiskPercentage(userAccount: UserAccount, MarginCalculationState: {
|
|
84
84
|
oracle_prices: OraclePrices;
|
|
85
85
|
perp_prices: PerpPrices;
|
|
@@ -94,64 +94,64 @@ export declare class ExchangeConnection extends BaseConnection {
|
|
|
94
94
|
oracle_prices: OraclePrices;
|
|
95
95
|
perp_prices: PerpPrices;
|
|
96
96
|
margin_config: MarginConfig;
|
|
97
|
-
}):
|
|
97
|
+
}): Decimal;
|
|
98
98
|
calculateMaxOrderSize(market: MarketName, price: Decimal, side: Side, order_type: OrderType, reduce_only: boolean, userAccount: UserAccount, MarginCalculationState: {
|
|
99
99
|
oracle_prices: OraclePrices;
|
|
100
100
|
perp_prices: PerpPrices;
|
|
101
101
|
margin_config: MarginConfig;
|
|
102
|
-
}, orderbook: OrderbookL2, n_iterations?: number, error_tolerance?: Decimal):
|
|
102
|
+
}, orderbook: OrderbookL2, n_iterations?: number, error_tolerance?: Decimal): Decimal;
|
|
103
103
|
simulateUsedMarginOnBorrow(asset: AssetName, borrowAmount: Decimal, userAccount: UserAccount, marginType: MarginType, MarginCalculationState: {
|
|
104
104
|
oracle_prices: OraclePrices;
|
|
105
105
|
perp_prices: PerpPrices;
|
|
106
106
|
margin_config: MarginConfig;
|
|
107
|
-
}):
|
|
107
|
+
}): {
|
|
108
108
|
current: Decimal;
|
|
109
109
|
updated: Decimal;
|
|
110
|
-
}
|
|
110
|
+
};
|
|
111
111
|
simulateUsedMarginOnOrder(placeOrderArgs: PlaceOrderArgs, userAccount: UserAccount, MarginCalculationState: {
|
|
112
112
|
oracle_prices: OraclePrices;
|
|
113
113
|
perp_prices: PerpPrices;
|
|
114
114
|
margin_config: MarginConfig;
|
|
115
|
-
}, orderbook: OrderbookL2):
|
|
115
|
+
}, orderbook: OrderbookL2): {
|
|
116
116
|
current: Decimal;
|
|
117
117
|
updated: Decimal;
|
|
118
|
-
}
|
|
118
|
+
};
|
|
119
119
|
simulateEstimatedLiquidationPriceOnOrder(placeOrderArgs: PlaceOrderArgs, baseAsset: AssetName, userAccount: UserAccount, MarginCalculationState: {
|
|
120
120
|
oracle_prices: OraclePrices;
|
|
121
121
|
perp_prices: PerpPrices;
|
|
122
122
|
margin_config: MarginConfig;
|
|
123
|
-
}, orderbook: OrderbookL2):
|
|
123
|
+
}, orderbook: OrderbookL2): {
|
|
124
124
|
current: Decimal;
|
|
125
125
|
updated: Decimal;
|
|
126
|
-
}
|
|
126
|
+
};
|
|
127
127
|
calculatePositionsAdditionalMetadata(userAccount: UserAccount, MarginCalculationState: {
|
|
128
128
|
oracle_prices: OraclePrices;
|
|
129
129
|
perp_prices: PerpPrices;
|
|
130
130
|
margin_config: MarginConfig;
|
|
131
|
-
}):
|
|
131
|
+
}): Map<number, {
|
|
132
132
|
projected_funding_payment: Decimal;
|
|
133
133
|
unrealized_pnl: Decimal;
|
|
134
134
|
liquidation_price: Decimal;
|
|
135
135
|
liquidation_risk_percentage: Decimal;
|
|
136
136
|
max_leverage_to_use: number;
|
|
137
|
-
}
|
|
138
|
-
calculateBorrowLendMarketAdditionalMetadata(borrowLendMarkets: BorrowLendPools, asset: AssetName):
|
|
137
|
+
}>;
|
|
138
|
+
calculateBorrowLendMarketAdditionalMetadata(borrowLendMarkets: BorrowLendPools, asset: AssetName): {
|
|
139
139
|
utilisation_rate: Decimal;
|
|
140
140
|
current_deposit_rate: Decimal;
|
|
141
141
|
current_borrow_rate: Decimal;
|
|
142
|
-
}
|
|
142
|
+
};
|
|
143
143
|
calculateAccountSummaryBatch(userAccounts: UserAccount[], MarginCalculationState: {
|
|
144
144
|
oracle_prices: OraclePrices;
|
|
145
145
|
perp_prices: PerpPrices;
|
|
146
146
|
margin_config: MarginConfig;
|
|
147
|
-
}, useWeightedEquity?: boolean):
|
|
147
|
+
}, useWeightedEquity?: boolean): {
|
|
148
148
|
address: string;
|
|
149
149
|
unrealized_pnl: Decimal;
|
|
150
150
|
equity: Decimal;
|
|
151
151
|
available_initial_margin: Decimal;
|
|
152
152
|
available_maintenance_margin: Decimal;
|
|
153
153
|
leverage: Decimal;
|
|
154
|
-
}[]
|
|
154
|
+
}[];
|
|
155
155
|
private getWebSocketManager;
|
|
156
156
|
subscribeOrderbook(market: MarketName): AsyncIterable<Orderbook>;
|
|
157
157
|
unsubscribeOrderbook(market: MarketName): Promise<void>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export type AssetId = number;
|
|
|
9
9
|
export type MarketId = number;
|
|
10
10
|
export type OrderId = bigint;
|
|
11
11
|
export type ClientOrderId = bigint;
|
|
12
|
-
export type MarketKind = "Perp" | "Spot";
|
|
13
12
|
export type Side = "Bid" | "Ask";
|
|
14
13
|
export type TriggerDirection = "GreaterThanOrEqual" | "LessThanOrEqual";
|
|
15
14
|
export type TpslPriceCondition = "Mark" | "Oracle" | "LastTrade";
|