@bulletxyz/bullet-sdk 0.26.2 → 0.26.3
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 +106 -27
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +106 -27
- package/dist/node/index.js.map +2 -2
- package/dist/types/client.d.ts +6 -4
- package/dist/types/exchange.d.ts +16 -16
- package/dist/types/rollupTypes.d.ts +40 -5
- package/dist/types/zod-types/rest.d.ts +16 -0
- package/package.json +1 -1
package/dist/types/client.d.ts
CHANGED
|
@@ -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 AssetName, type MarkPriceUpdateArgs, type MarketName, type Network, type OraclePriceUpdateArgs, type PlaceOrderArgs, type PlacePositionTpslArgs, type TokenId } from "./types";
|
|
7
|
+
import { type Address, type AssetId, type AssetName, type MarkPriceUpdateArgs, type MarketName, 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;
|
|
@@ -165,7 +165,7 @@ export declare class Client {
|
|
|
165
165
|
placeOrder(placeOrderArgs: PlaceOrderArgs): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
166
166
|
createPositionTpsl(market: MarketName, tpslOrders: PlacePositionTpslArgs): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
167
167
|
amendOrder(options: AmendOrderOptions): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
168
|
-
|
|
168
|
+
cancelTpsls(tpslOrderIds: bigint[]): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
169
169
|
cancelOrder(orderId?: bigint, clientOrderId?: bigint): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
170
170
|
cancelAllOrdersForMarket(market: MarketName): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
171
171
|
updateOraclePrices(pricesToUpdate: OraclePriceUpdateArgs[], publishTimestamp?: number): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
@@ -184,8 +184,10 @@ export declare class Client {
|
|
|
184
184
|
liquidateSpotLiability(address: Address, liabilityAssetId: AssetName, collateralAssetId: AssetName, liabilityAmount: Decimal): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
185
185
|
depositToUsdcPnlPool(amount: Decimal): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
186
186
|
depositToInsuranceFund(amount: Decimal): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
187
|
-
initAssetMetadata(asset_id: number, assetName: string, tokenId: TokenId, decimals: number): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
188
|
-
|
|
187
|
+
initAssetMetadata(asset_id: number, assetName: string, tokenId: TokenId, decimals: number, withdrawFee: Decimal): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
188
|
+
initSpotMarket(marketId: number, baseAssetId: number, quoteAssetId: AssetId, baseMinLotSize: Decimal, quoteMinLotSize: Decimal, maxOrdersPerSide: number, takerFeesTenthBps: number[], makerFeesTenthBps: number[], name: string): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
189
|
+
initPerpMarket(marketId: number, baseAssetId: number, name: string, minTickSize: Decimal, minLotSize: Decimal, maxOrdersPerSide: number, minInterestRateClamp: Decimal, maxInterestRateClamp: Decimal, minFundingRateClamp: Decimal, maxFundingRateClamp: Decimal, impactMargin: Decimal, interestRate: Decimal, initLeverageTableArgs: Map<Decimal, number>, takerFeesTenthBps: number[], makerFeesTenthBps: number[]): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
190
|
+
initBorrowLendPool(assetId: number, optimalUtilisationRate: Decimal, minBorrowRate: Decimal, maxBorrowRate: Decimal, optimalBorrowRate: Decimal, assetWeight: Decimal, initialLiabilityWeight: Decimal, maintenanceLiabilityWeight: Decimal, depositLimit: Decimal, borrowLimit: Decimal, liquidationTotalRewardRatio: Decimal, protocolRewardRatio: Decimal, liabilityLiquidationLimitRatio: Decimal, interestFeeTenthBps: number): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
189
191
|
updateBorrowLendMarket(asset: AssetName, optimalUtilisationRate: Decimal | null, minBorrowRate: Decimal | null, maxBorrowRate: Decimal | null, optimalBorrowRate: Decimal | null, assetWeight: Decimal | null, initialLiabilityWeight: Decimal | null, maintenanceLiabilityWeight: Decimal | null, depositLimit: Decimal | null, borrowLimit: Decimal | null, liquidationRewardRatio: Decimal | null, liabilityLiquidationLimitRatio: Decimal | null): Promise<TransactionResult<Transaction<RuntimeCall>>>;
|
|
190
192
|
}
|
|
191
193
|
export {};
|
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>;
|
|
@@ -109,8 +109,8 @@ type ExchangeCallMessage = {
|
|
|
109
109
|
tpsl: PendingTriggerOrderArgs | null;
|
|
110
110
|
};
|
|
111
111
|
};
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
cancel_tpsls: {
|
|
113
|
+
tpsl_order_ids: string[];
|
|
114
114
|
};
|
|
115
115
|
cancel_orders: {
|
|
116
116
|
args: {
|
|
@@ -158,7 +158,7 @@ type ExchangeCallMessage = {
|
|
|
158
158
|
force_close_positions: {
|
|
159
159
|
address: Address;
|
|
160
160
|
};
|
|
161
|
-
|
|
161
|
+
liquidate_perp_positions: {
|
|
162
162
|
address: Address;
|
|
163
163
|
positions: {
|
|
164
164
|
market_id: MarketId;
|
|
@@ -183,9 +183,42 @@ type ExchangeCallMessage = {
|
|
|
183
183
|
asset_name: string;
|
|
184
184
|
token_id: TokenId;
|
|
185
185
|
decimals: number;
|
|
186
|
+
withdraw_fee: number;
|
|
186
187
|
};
|
|
187
188
|
};
|
|
188
|
-
|
|
189
|
+
init_spot_market: {
|
|
190
|
+
args: {
|
|
191
|
+
market_id: MarketId;
|
|
192
|
+
base_asset_id: AssetId;
|
|
193
|
+
quote_asset_id: AssetId;
|
|
194
|
+
base_min_lot_size: number;
|
|
195
|
+
quote_min_lot_size: number;
|
|
196
|
+
max_orders_per_side: number;
|
|
197
|
+
taker_fees_tenth_bps: number[];
|
|
198
|
+
maker_fees_tenth_bps: number[];
|
|
199
|
+
name: string;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
init_perp_market: {
|
|
203
|
+
args: {
|
|
204
|
+
market_id: MarketId;
|
|
205
|
+
base_asset_id: AssetId;
|
|
206
|
+
name: string;
|
|
207
|
+
min_tick_size: number;
|
|
208
|
+
min_lot_size: number;
|
|
209
|
+
max_orders_per_side: number;
|
|
210
|
+
min_interest_rate_clamp: number;
|
|
211
|
+
max_interest_rate_clamp: number;
|
|
212
|
+
min_funding_rate_clamp: number;
|
|
213
|
+
max_funding_rate_clamp: number;
|
|
214
|
+
impact_margin: number;
|
|
215
|
+
interest_rate: number;
|
|
216
|
+
init_leverage_table_args: Map<number, number>;
|
|
217
|
+
taker_fees_tenth_bps: number[];
|
|
218
|
+
maker_fees_tenth_bps: number[];
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
init_borrow_lend_pool: {
|
|
189
222
|
args: {
|
|
190
223
|
asset_id: AssetId;
|
|
191
224
|
optimal_utilisation_rate: number;
|
|
@@ -197,8 +230,10 @@ type ExchangeCallMessage = {
|
|
|
197
230
|
maintenance_liability_weight: number;
|
|
198
231
|
deposit_limit: number;
|
|
199
232
|
borrow_limit: number;
|
|
200
|
-
|
|
233
|
+
liquidation_total_reward_ratio: number;
|
|
234
|
+
protocol_reward_ratio: number;
|
|
201
235
|
liability_liquidation_limit_ratio: number;
|
|
236
|
+
interest_fee_tenth_bps: number;
|
|
202
237
|
};
|
|
203
238
|
};
|
|
204
239
|
update_borrow_lend_market: {
|
|
@@ -2147,26 +2147,31 @@ export declare const Schemas: {
|
|
|
2147
2147
|
name: z.ZodString;
|
|
2148
2148
|
token_id: z.ZodString;
|
|
2149
2149
|
decimals: z.ZodNumber;
|
|
2150
|
+
withdraw_fee: z.ZodString;
|
|
2150
2151
|
}, "strip", z.ZodTypeAny, {
|
|
2151
2152
|
token_id: string;
|
|
2152
2153
|
id: number;
|
|
2153
2154
|
name: string;
|
|
2154
2155
|
decimals: number;
|
|
2156
|
+
withdraw_fee: string;
|
|
2155
2157
|
}, {
|
|
2156
2158
|
token_id: string;
|
|
2157
2159
|
id: number;
|
|
2158
2160
|
name: string;
|
|
2159
2161
|
decimals: number;
|
|
2162
|
+
withdraw_fee: string;
|
|
2160
2163
|
}>>, Map<number, {
|
|
2161
2164
|
token_id: string;
|
|
2162
2165
|
id: number;
|
|
2163
2166
|
name: string;
|
|
2164
2167
|
decimals: number;
|
|
2168
|
+
withdraw_fee: string;
|
|
2165
2169
|
}>, Record<string, {
|
|
2166
2170
|
token_id: string;
|
|
2167
2171
|
id: number;
|
|
2168
2172
|
name: string;
|
|
2169
2173
|
decimals: number;
|
|
2174
|
+
withdraw_fee: string;
|
|
2170
2175
|
}>>;
|
|
2171
2176
|
}, "strip", z.ZodTypeAny, {
|
|
2172
2177
|
metas: Map<number, {
|
|
@@ -2174,6 +2179,7 @@ export declare const Schemas: {
|
|
|
2174
2179
|
id: number;
|
|
2175
2180
|
name: string;
|
|
2176
2181
|
decimals: number;
|
|
2182
|
+
withdraw_fee: string;
|
|
2177
2183
|
}>;
|
|
2178
2184
|
}, {
|
|
2179
2185
|
metas: Record<string, {
|
|
@@ -2181,6 +2187,7 @@ export declare const Schemas: {
|
|
|
2181
2187
|
id: number;
|
|
2182
2188
|
name: string;
|
|
2183
2189
|
decimals: number;
|
|
2190
|
+
withdraw_fee: string;
|
|
2184
2191
|
}>;
|
|
2185
2192
|
}>;
|
|
2186
2193
|
readonly MarketRegistry: z.ZodObject<{
|
|
@@ -2855,26 +2862,31 @@ export declare const ResponseSchemas: {
|
|
|
2855
2862
|
name: z.ZodString;
|
|
2856
2863
|
token_id: z.ZodString;
|
|
2857
2864
|
decimals: z.ZodNumber;
|
|
2865
|
+
withdraw_fee: z.ZodString;
|
|
2858
2866
|
}, "strip", z.ZodTypeAny, {
|
|
2859
2867
|
token_id: string;
|
|
2860
2868
|
id: number;
|
|
2861
2869
|
name: string;
|
|
2862
2870
|
decimals: number;
|
|
2871
|
+
withdraw_fee: string;
|
|
2863
2872
|
}, {
|
|
2864
2873
|
token_id: string;
|
|
2865
2874
|
id: number;
|
|
2866
2875
|
name: string;
|
|
2867
2876
|
decimals: number;
|
|
2877
|
+
withdraw_fee: string;
|
|
2868
2878
|
}>>, Map<number, {
|
|
2869
2879
|
token_id: string;
|
|
2870
2880
|
id: number;
|
|
2871
2881
|
name: string;
|
|
2872
2882
|
decimals: number;
|
|
2883
|
+
withdraw_fee: string;
|
|
2873
2884
|
}>, Record<string, {
|
|
2874
2885
|
token_id: string;
|
|
2875
2886
|
id: number;
|
|
2876
2887
|
name: string;
|
|
2877
2888
|
decimals: number;
|
|
2889
|
+
withdraw_fee: string;
|
|
2878
2890
|
}>>;
|
|
2879
2891
|
}, "strip", z.ZodTypeAny, {
|
|
2880
2892
|
metas: Map<number, {
|
|
@@ -2882,6 +2894,7 @@ export declare const ResponseSchemas: {
|
|
|
2882
2894
|
id: number;
|
|
2883
2895
|
name: string;
|
|
2884
2896
|
decimals: number;
|
|
2897
|
+
withdraw_fee: string;
|
|
2885
2898
|
}>;
|
|
2886
2899
|
}, {
|
|
2887
2900
|
metas: Record<string, {
|
|
@@ -2889,6 +2902,7 @@ export declare const ResponseSchemas: {
|
|
|
2889
2902
|
id: number;
|
|
2890
2903
|
name: string;
|
|
2891
2904
|
decimals: number;
|
|
2905
|
+
withdraw_fee: string;
|
|
2892
2906
|
}>;
|
|
2893
2907
|
}>>;
|
|
2894
2908
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -2898,6 +2912,7 @@ export declare const ResponseSchemas: {
|
|
|
2898
2912
|
id: number;
|
|
2899
2913
|
name: string;
|
|
2900
2914
|
decimals: number;
|
|
2915
|
+
withdraw_fee: string;
|
|
2901
2916
|
}>;
|
|
2902
2917
|
} | null;
|
|
2903
2918
|
}, {
|
|
@@ -2907,6 +2922,7 @@ export declare const ResponseSchemas: {
|
|
|
2907
2922
|
id: number;
|
|
2908
2923
|
name: string;
|
|
2909
2924
|
decimals: number;
|
|
2925
|
+
withdraw_fee: string;
|
|
2910
2926
|
}>;
|
|
2911
2927
|
} | null;
|
|
2912
2928
|
}>;
|