@bulletxyz/bullet-sdk 0.26.1-rc.0 → 0.26.2-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.
- package/dist/browser/index.js +280 -401
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +281 -402
- package/dist/node/index.js.map +2 -2
- package/dist/types/bullet-wasm/index.d.ts +1 -1
- package/dist/types/client.d.ts +49 -1
- package/dist/types/exchange.d.ts +3 -3
- package/dist/types/rollupTypes.d.ts +27 -20
- package/dist/types/types.d.ts +1 -0
- package/dist/types/zod-types/rest.d.ts +4803 -4124
- package/dist/types/zod-types/ws.d.ts +4 -4
- package/package.json +84 -84
|
@@ -15,7 +15,7 @@ export class BulletWasm {
|
|
|
15
15
|
static calculate_account_leverage(user_account: any, margin_calculation_state: any): string;
|
|
16
16
|
static calculate_available_margin(user_account: any, conservative: boolean, margin_type: MarginType, margin_calculation_state: any): string;
|
|
17
17
|
static calculate_used_margin(user_account: any, withdrawal: boolean, margin_type: MarginType, margin_calculation_state: any): string;
|
|
18
|
-
static calculate_withdrawable_amount_of_asset(user_account: any, asset_id: number, margin_calculation_state: any): string;
|
|
18
|
+
static calculate_withdrawable_amount_of_asset(user_account: any, asset_id: number, margin_calculation_state: any, asset_registry: any): string;
|
|
19
19
|
static calculate_estimated_liquidation_price(user_account: any, market_id: number, base_asset_id: number, margin_calculation_state: any): string;
|
|
20
20
|
static calculate_liquidation_risk_percentage(user_account: any, margin_calculation_state: any): string;
|
|
21
21
|
static calculate_force_cancel_risk_percentage(user_account: any, margin_calculation_state: any): string;
|
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
|
@@ -5,7 +5,7 @@ import { type Endpoints } from "./constants";
|
|
|
5
5
|
import type { Orderbook } from "./orderbook";
|
|
6
6
|
import type { Address, AssetName, MarketName, Network } from "./types";
|
|
7
7
|
import type { OrderType, PlaceOrderArgs, Side } from "./types";
|
|
8
|
-
import { type AccountAddresses, type AssetRegistry, type
|
|
8
|
+
import { type AccountAddresses, type AssetRegistry, type BorrowLendPools, type GlobalParameters, type MarginConfig, type MarketRegistry, type OraclePrices, type Order, type OrderbookL2, type PerpMarket, type PerpPrices, type TpslOrderIdsToExecute, type UsdcInsuranceFund, type UsdcPnlPool, type UserAccount } from "./zod-types/rest";
|
|
9
9
|
export declare class ExchangeConnection extends BaseConnection {
|
|
10
10
|
private wsManager?;
|
|
11
11
|
private assetRegistry?;
|
|
@@ -37,7 +37,7 @@ export declare class ExchangeConnection extends BaseConnection {
|
|
|
37
37
|
getPerpPrices(): Promise<PerpPrices | null>;
|
|
38
38
|
getUsdcPnlPool(): Promise<UsdcPnlPool | null>;
|
|
39
39
|
getUsdcInsuranceFund(): Promise<UsdcInsuranceFund | null>;
|
|
40
|
-
getBorrowLendMarkets(): Promise<
|
|
40
|
+
getBorrowLendMarkets(): Promise<BorrowLendPools>;
|
|
41
41
|
getPerpMarket(market: MarketName): Promise<PerpMarket>;
|
|
42
42
|
getPerpMarkets(markets: MarketName[]): Promise<Map<number, PerpMarket>>;
|
|
43
43
|
getMarginConfig(): Promise<MarginConfig | null>;
|
|
@@ -135,7 +135,7 @@ export declare class ExchangeConnection extends BaseConnection {
|
|
|
135
135
|
liquidation_risk_percentage: Decimal;
|
|
136
136
|
max_leverage_to_use: number;
|
|
137
137
|
}>;
|
|
138
|
-
calculateBorrowLendMarketAdditionalMetadata(borrowLendMarkets:
|
|
138
|
+
calculateBorrowLendMarketAdditionalMetadata(borrowLendMarkets: BorrowLendPools, asset: AssetName): {
|
|
139
139
|
utilisation_rate: Decimal;
|
|
140
140
|
current_deposit_rate: Decimal;
|
|
141
141
|
current_borrow_rate: Decimal;
|
|
@@ -55,27 +55,28 @@ type PendingTriggerOrderArgs = {
|
|
|
55
55
|
pending_sl: TriggerOrderArgs | null;
|
|
56
56
|
dynamic_size: boolean;
|
|
57
57
|
};
|
|
58
|
-
type PlacePositionTpslArgs = {
|
|
59
|
-
tp: TriggerOrderArgs | null;
|
|
60
|
-
sl: TriggerOrderArgs | null;
|
|
61
|
-
size: number | null;
|
|
62
|
-
};
|
|
63
58
|
type ExchangeCallMessage = {
|
|
64
59
|
set_value: number;
|
|
65
60
|
deposit: {
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
args: {
|
|
62
|
+
asset_id: AssetId;
|
|
63
|
+
amount: number;
|
|
64
|
+
};
|
|
68
65
|
};
|
|
69
66
|
withdraw: {
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
args: {
|
|
68
|
+
asset_id: AssetId;
|
|
69
|
+
amount: number;
|
|
70
|
+
};
|
|
72
71
|
};
|
|
73
72
|
borrow_spot: {
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
args: {
|
|
74
|
+
asset_id: AssetId;
|
|
75
|
+
amount: number;
|
|
76
|
+
};
|
|
76
77
|
};
|
|
77
78
|
place_order: {
|
|
78
|
-
|
|
79
|
+
args: {
|
|
79
80
|
market_id: MarketId;
|
|
80
81
|
price: number;
|
|
81
82
|
size: number;
|
|
@@ -88,12 +89,16 @@ type ExchangeCallMessage = {
|
|
|
88
89
|
};
|
|
89
90
|
create_position_tpsl: {
|
|
90
91
|
market_id: MarketId;
|
|
91
|
-
|
|
92
|
+
args: {
|
|
93
|
+
tp: TriggerOrderArgs | null;
|
|
94
|
+
sl: TriggerOrderArgs | null;
|
|
95
|
+
size: number | null;
|
|
96
|
+
};
|
|
92
97
|
};
|
|
93
98
|
amend_order: {
|
|
94
99
|
existing_order_id: string | null;
|
|
95
100
|
existing_client_order_id: string | null;
|
|
96
|
-
|
|
101
|
+
args: {
|
|
97
102
|
market_id: MarketId;
|
|
98
103
|
price: number;
|
|
99
104
|
size: number;
|
|
@@ -104,12 +109,14 @@ type ExchangeCallMessage = {
|
|
|
104
109
|
tpsl: PendingTriggerOrderArgs | null;
|
|
105
110
|
};
|
|
106
111
|
};
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
cancel_tpsls: {
|
|
113
|
+
tpsl_order_ids: string[];
|
|
109
114
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
cancel_orders: {
|
|
116
|
+
args: {
|
|
117
|
+
order_id: string | null;
|
|
118
|
+
client_order_id: string | null;
|
|
119
|
+
}[];
|
|
113
120
|
};
|
|
114
121
|
cancel_all_orders_for_market: {
|
|
115
122
|
market_id: MarketId;
|
|
@@ -136,7 +143,7 @@ type ExchangeCallMessage = {
|
|
|
136
143
|
update_premium_indexes: {
|
|
137
144
|
market_ids: MarketId[];
|
|
138
145
|
};
|
|
139
|
-
|
|
146
|
+
process_tpsl_buffer: {
|
|
140
147
|
market_id: MarketId;
|
|
141
148
|
};
|
|
142
149
|
update_funding: {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ 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";
|
|
12
13
|
export type Side = "Bid" | "Ask";
|
|
13
14
|
export type TriggerDirection = "GreaterThanOrEqual" | "LessThanOrEqual";
|
|
14
15
|
export type TpslPriceCondition = "Mark" | "Oracle" | "LastTrade";
|