@bulletxyz/bullet-sdk 0.25.0-rc.6 → 0.25.0-rc.8
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 +43 -63
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +43 -63
- package/dist/node/index.js.map +2 -2
- package/dist/types/bullet-wasm/index.d.ts +3 -3
- package/dist/types/calc.d.ts +4 -4
- package/dist/types/client.d.ts +0 -10
- package/dist/types/zod-types/rest.d.ts +370 -769
- package/package.json +1 -1
|
@@ -23,12 +23,12 @@ export class BulletWasm {
|
|
|
23
23
|
* Calculates the maximum amount that can be borrowed for a given asset
|
|
24
24
|
* @param initial_liability_weight The initial liability weight for the market must be passed in separately since the user may not have a spot ledger for this asset yet
|
|
25
25
|
*/
|
|
26
|
-
static calculate_max_borrow_amount(asset_id: number,
|
|
26
|
+
static calculate_max_borrow_amount(asset_id: number, user_account: any, margin_calculation_state: any): string;
|
|
27
27
|
static calculate_max_order_size(market_id: number, price: string, side: Side, order_type: OrderType, reduce_only: boolean, user_account: any, margin_calculation_state: any, orderbook: any, n_iterations: number, error_tolerance: string): string;
|
|
28
|
-
static simulate_used_margin_on_borrow(asset_id: number, borrow_amount: string,
|
|
28
|
+
static simulate_used_margin_on_borrow(asset_id: number, borrow_amount: string, user_account: any, margin_type: MarginType, margin_calculation_state: any): any;
|
|
29
29
|
static simulate_used_margin_on_order(place_order_args: any, user_account: any, margin_calculation_state: any, orderbook: any): any;
|
|
30
30
|
static simulate_estimated_liquidation_price_on_order(place_order_args: any, base_asset: number, user_account: any, margin_calculation_state: any, orderbook: any): any;
|
|
31
|
-
static calculate_positions_additional_metadata(user_account: any, margin_calculation_state: any
|
|
31
|
+
static calculate_positions_additional_metadata(user_account: any, margin_calculation_state: any): any;
|
|
32
32
|
static calculate_borrow_lend_additional_metadata(borrow_lend_market: any): any;
|
|
33
33
|
static calculate_account_summary_batch(user_accounts: any, margin_calculation_state: any, use_weighted_equity: boolean): any;
|
|
34
34
|
}
|
package/dist/types/calc.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Decimal from "decimal.js";
|
|
2
2
|
import { type EquityType, type MarginType } from "./bullet-wasm";
|
|
3
3
|
import type { Asset, Market, OrderType, PlaceOrderArgs, Side } from "./types";
|
|
4
|
-
import type { BorrowLendMarkets,
|
|
4
|
+
import type { BorrowLendMarkets, MarginConfig, OraclePrices, OrderbookL2, PerpPrices, UserAccount } from "./zod-types/rest";
|
|
5
5
|
export declare function calculateOrderbookMidpoint(orderbook: OrderbookL2): Decimal | undefined;
|
|
6
6
|
export declare function calculateEntryPrice(market: Market, userAccount: UserAccount): Decimal;
|
|
7
7
|
export interface MarginCalculationState {
|
|
@@ -18,9 +18,9 @@ export declare function calculateWithdrawableAmountOfAsset(asset: Asset, userAcc
|
|
|
18
18
|
export declare function calculateEstimatedLiquidationPrice(market: Market, asset: Asset, userAccount: UserAccount, MarginCalculationState: MarginCalculationState): Decimal;
|
|
19
19
|
export declare function calculateLiquidationRiskPercentage(userAccount: UserAccount, MarginCalculationState: MarginCalculationState): Decimal;
|
|
20
20
|
export declare function calculateForceCancelRiskPercentage(userAccount: UserAccount, MarginCalculationState: MarginCalculationState): Decimal;
|
|
21
|
-
export declare function calculateMaxBorrowAmount(asset: Asset,
|
|
21
|
+
export declare function calculateMaxBorrowAmount(asset: Asset, userAccount: UserAccount, MarginCalculationState: MarginCalculationState): Decimal;
|
|
22
22
|
export declare function calculateMaxOrderSize(market: Market, price: Decimal, side: Side, order_type: OrderType, reduce_only: boolean, userAccount: UserAccount, MarginCalculationState: MarginCalculationState, orderbook: OrderbookL2, n_iterations?: number, error_tolerance?: Decimal): Decimal;
|
|
23
|
-
export declare function simulateUsedMarginOnBorrow(asset: Asset, borrowAmount: Decimal,
|
|
23
|
+
export declare function simulateUsedMarginOnBorrow(asset: Asset, borrowAmount: Decimal, userAccount: UserAccount, marginType: MarginType, MarginCalculationState: MarginCalculationState): {
|
|
24
24
|
current: Decimal;
|
|
25
25
|
updated: Decimal;
|
|
26
26
|
};
|
|
@@ -32,7 +32,7 @@ export declare function simulateEstimatedLiquidationPriceOnOrder(placeOrderArgs:
|
|
|
32
32
|
current: Decimal;
|
|
33
33
|
updated: Decimal;
|
|
34
34
|
};
|
|
35
|
-
export declare function calculatePositionsAdditionalMetadata(userAccount: UserAccount, MarginCalculationState: MarginCalculationState
|
|
35
|
+
export declare function calculatePositionsAdditionalMetadata(userAccount: UserAccount, MarginCalculationState: MarginCalculationState): Map<number, {
|
|
36
36
|
projected_funding_payment: Decimal;
|
|
37
37
|
unrealized_pnl: Decimal;
|
|
38
38
|
liquidation_price: Decimal;
|
package/dist/types/client.d.ts
CHANGED
|
@@ -31,11 +31,6 @@ export declare class Client {
|
|
|
31
31
|
address: string;
|
|
32
32
|
usdc_ledger: {
|
|
33
33
|
ledger: {
|
|
34
|
-
weights: {
|
|
35
|
-
asset_weight: Decimal;
|
|
36
|
-
initial_liability_weight: Decimal;
|
|
37
|
-
maintenance_liability_weight: Decimal;
|
|
38
|
-
};
|
|
39
34
|
asset: Decimal;
|
|
40
35
|
liability: Decimal;
|
|
41
36
|
};
|
|
@@ -44,11 +39,6 @@ export declare class Client {
|
|
|
44
39
|
};
|
|
45
40
|
client_order_ids: Map<bigint, bigint>;
|
|
46
41
|
spot_ledgers: Map<number, {
|
|
47
|
-
weights: {
|
|
48
|
-
asset_weight: Decimal;
|
|
49
|
-
initial_liability_weight: Decimal;
|
|
50
|
-
maintenance_liability_weight: Decimal;
|
|
51
|
-
};
|
|
52
42
|
asset: Decimal;
|
|
53
43
|
liability: Decimal;
|
|
54
44
|
}>;
|