@bulletxyz/bullet-sdk 0.26.0-rc.1 → 0.26.1-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 +11 -13
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +11 -13
- package/dist/node/index.js.map +2 -2
- package/dist/types/exchange.d.ts +16 -16
- package/dist/types/types.d.ts +0 -1
- package/dist/types/zod-types/rest.d.ts +0 -18
- package/package.json +1 -1
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: BorrowLendMarkets, asset: AssetName):
|
|
137
|
+
}>;
|
|
138
|
+
calculateBorrowLendMarketAdditionalMetadata(borrowLendMarkets: BorrowLendMarkets, 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";
|
|
@@ -1946,42 +1946,35 @@ export declare const Schemas: {
|
|
|
1946
1946
|
readonly MarketRegistry: z.ZodObject<{
|
|
1947
1947
|
metas: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1948
1948
|
id: z.ZodNumber;
|
|
1949
|
-
kind: z.ZodEnum<["Perp", "Spot"]>;
|
|
1950
1949
|
base_asset_id: z.ZodNumber;
|
|
1951
1950
|
name: z.ZodString;
|
|
1952
1951
|
}, "strip", z.ZodTypeAny, {
|
|
1953
1952
|
id: number;
|
|
1954
1953
|
name: string;
|
|
1955
|
-
kind: "Perp" | "Spot";
|
|
1956
1954
|
base_asset_id: number;
|
|
1957
1955
|
}, {
|
|
1958
1956
|
id: number;
|
|
1959
1957
|
name: string;
|
|
1960
|
-
kind: "Perp" | "Spot";
|
|
1961
1958
|
base_asset_id: number;
|
|
1962
1959
|
}>>, Map<number, {
|
|
1963
1960
|
id: number;
|
|
1964
1961
|
name: string;
|
|
1965
|
-
kind: "Perp" | "Spot";
|
|
1966
1962
|
base_asset_id: number;
|
|
1967
1963
|
}>, Record<string, {
|
|
1968
1964
|
id: number;
|
|
1969
1965
|
name: string;
|
|
1970
|
-
kind: "Perp" | "Spot";
|
|
1971
1966
|
base_asset_id: number;
|
|
1972
1967
|
}>>;
|
|
1973
1968
|
}, "strip", z.ZodTypeAny, {
|
|
1974
1969
|
metas: Map<number, {
|
|
1975
1970
|
id: number;
|
|
1976
1971
|
name: string;
|
|
1977
|
-
kind: "Perp" | "Spot";
|
|
1978
1972
|
base_asset_id: number;
|
|
1979
1973
|
}>;
|
|
1980
1974
|
}, {
|
|
1981
1975
|
metas: Record<string, {
|
|
1982
1976
|
id: number;
|
|
1983
1977
|
name: string;
|
|
1984
|
-
kind: "Perp" | "Spot";
|
|
1985
1978
|
base_asset_id: number;
|
|
1986
1979
|
}>;
|
|
1987
1980
|
}>;
|
|
@@ -2950,42 +2943,35 @@ export declare const ResponseSchemas: {
|
|
|
2950
2943
|
value: z.ZodNullable<z.ZodObject<{
|
|
2951
2944
|
metas: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2952
2945
|
id: z.ZodNumber;
|
|
2953
|
-
kind: z.ZodEnum<["Perp", "Spot"]>;
|
|
2954
2946
|
base_asset_id: z.ZodNumber;
|
|
2955
2947
|
name: z.ZodString;
|
|
2956
2948
|
}, "strip", z.ZodTypeAny, {
|
|
2957
2949
|
id: number;
|
|
2958
2950
|
name: string;
|
|
2959
|
-
kind: "Perp" | "Spot";
|
|
2960
2951
|
base_asset_id: number;
|
|
2961
2952
|
}, {
|
|
2962
2953
|
id: number;
|
|
2963
2954
|
name: string;
|
|
2964
|
-
kind: "Perp" | "Spot";
|
|
2965
2955
|
base_asset_id: number;
|
|
2966
2956
|
}>>, Map<number, {
|
|
2967
2957
|
id: number;
|
|
2968
2958
|
name: string;
|
|
2969
|
-
kind: "Perp" | "Spot";
|
|
2970
2959
|
base_asset_id: number;
|
|
2971
2960
|
}>, Record<string, {
|
|
2972
2961
|
id: number;
|
|
2973
2962
|
name: string;
|
|
2974
|
-
kind: "Perp" | "Spot";
|
|
2975
2963
|
base_asset_id: number;
|
|
2976
2964
|
}>>;
|
|
2977
2965
|
}, "strip", z.ZodTypeAny, {
|
|
2978
2966
|
metas: Map<number, {
|
|
2979
2967
|
id: number;
|
|
2980
2968
|
name: string;
|
|
2981
|
-
kind: "Perp" | "Spot";
|
|
2982
2969
|
base_asset_id: number;
|
|
2983
2970
|
}>;
|
|
2984
2971
|
}, {
|
|
2985
2972
|
metas: Record<string, {
|
|
2986
2973
|
id: number;
|
|
2987
2974
|
name: string;
|
|
2988
|
-
kind: "Perp" | "Spot";
|
|
2989
2975
|
base_asset_id: number;
|
|
2990
2976
|
}>;
|
|
2991
2977
|
}>>;
|
|
@@ -2994,7 +2980,6 @@ export declare const ResponseSchemas: {
|
|
|
2994
2980
|
metas: Map<number, {
|
|
2995
2981
|
id: number;
|
|
2996
2982
|
name: string;
|
|
2997
|
-
kind: "Perp" | "Spot";
|
|
2998
2983
|
base_asset_id: number;
|
|
2999
2984
|
}>;
|
|
3000
2985
|
} | null;
|
|
@@ -3003,7 +2988,6 @@ export declare const ResponseSchemas: {
|
|
|
3003
2988
|
metas: Record<string, {
|
|
3004
2989
|
id: number;
|
|
3005
2990
|
name: string;
|
|
3006
|
-
kind: "Perp" | "Spot";
|
|
3007
2991
|
base_asset_id: number;
|
|
3008
2992
|
}>;
|
|
3009
2993
|
} | null;
|
|
@@ -3015,7 +2999,6 @@ export declare const ResponseSchemas: {
|
|
|
3015
2999
|
metas: Map<number, {
|
|
3016
3000
|
id: number;
|
|
3017
3001
|
name: string;
|
|
3018
|
-
kind: "Perp" | "Spot";
|
|
3019
3002
|
base_asset_id: number;
|
|
3020
3003
|
}>;
|
|
3021
3004
|
} | null;
|
|
@@ -3027,7 +3010,6 @@ export declare const ResponseSchemas: {
|
|
|
3027
3010
|
metas: Record<string, {
|
|
3028
3011
|
id: number;
|
|
3029
3012
|
name: string;
|
|
3030
|
-
kind: "Perp" | "Spot";
|
|
3031
3013
|
base_asset_id: number;
|
|
3032
3014
|
}>;
|
|
3033
3015
|
} | null;
|