@bulletxyz/bullet-sdk 0.31.0-rc.0 → 0.31.0-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.
@@ -50,77 +50,77 @@ export declare class ExchangeConnection extends BaseConnection {
50
50
  getGlobalParameters(): Promise<GlobalParameters | null>;
51
51
  calculateOrderbookMidpoint(orderbook: OrderbookL2): Decimal | undefined;
52
52
  calculateEntryPrice(market: MarketName, userAccount: UserAccount): Decimal;
53
- calculateTotalPerpUnrealizedPnl(userAccount: UserAccount, MarginCalculationState: {
53
+ calculateTotalPerpUnrealizedPnl(userAccount: UserAccount, marginCalculationState: {
54
54
  oracle_prices: OraclePrices;
55
55
  perp_prices: PerpPrices;
56
56
  margin_config: MarginConfig;
57
57
  }): Decimal;
58
- calculateAccountEquity(equityType: EquityType, conservative: boolean, userAccount: UserAccount, MarginCalculationState: {
58
+ calculateAccountEquity(equityType: EquityType, conservative: boolean, userAccount: UserAccount, marginCalculationState: {
59
59
  oracle_prices: OraclePrices;
60
60
  perp_prices: PerpPrices;
61
61
  margin_config: MarginConfig;
62
62
  }): Decimal;
63
- calculateAccountLeverage(userAccount: UserAccount, MarginCalculationState: {
63
+ calculateAccountLeverage(userAccount: UserAccount, marginCalculationState: {
64
64
  oracle_prices: OraclePrices;
65
65
  perp_prices: PerpPrices;
66
66
  margin_config: MarginConfig;
67
67
  }): Decimal;
68
- calculateAvailableMargin(marginType: MarginType, conservative: boolean, userAccount: UserAccount, MarginCalculationState: {
68
+ calculateAvailableMargin(marginType: MarginType, conservative: boolean, userAccount: UserAccount, marginCalculationState: {
69
69
  oracle_prices: OraclePrices;
70
70
  perp_prices: PerpPrices;
71
71
  margin_config: MarginConfig;
72
72
  }): Decimal;
73
- calculateUsedMargin(withdrawal: boolean, marginType: MarginType, userAccount: UserAccount, MarginCalculationState: {
73
+ calculateUsedMargin(withdrawal: boolean, marginType: MarginType, userAccount: UserAccount, marginCalculationState: {
74
74
  oracle_prices: OraclePrices;
75
75
  perp_prices: PerpPrices;
76
76
  margin_config: MarginConfig;
77
77
  }): Decimal;
78
- calculateUsedPerpMargin(userAccount: UserAccount, marginType: MarginType, MarginCalculationState: {
78
+ calculateUsedPerpMargin(userAccount: UserAccount, marginType: MarginType, marginCalculationState: {
79
79
  oracle_prices: OraclePrices;
80
80
  perp_prices: PerpPrices;
81
81
  margin_config: MarginConfig;
82
82
  }): Decimal;
83
- calculateUsedSpotMargin(userAccount: UserAccount, marginType: MarginType, MarginCalculationState: {
83
+ calculateUsedSpotMargin(userAccount: UserAccount, marginType: MarginType, marginCalculationState: {
84
84
  oracle_prices: OraclePrices;
85
85
  perp_prices: PerpPrices;
86
86
  margin_config: MarginConfig;
87
87
  }): Decimal;
88
- calculateWithdrawableAmountOfAsset(asset: AssetName, userAccount: UserAccount, MarginCalculationState: {
88
+ calculateWithdrawableAmountOfAsset(asset: AssetName, userAccount: UserAccount, marginCalculationState: {
89
89
  oracle_prices: OraclePrices;
90
90
  perp_prices: PerpPrices;
91
91
  margin_config: MarginConfig;
92
92
  }): Promise<Decimal>;
93
- calculateEstimatedLiquidationPrice(market: MarketName, asset: AssetName, userAccount: UserAccount, MarginCalculationState: {
93
+ calculateEstimatedLiquidationPrice(market: MarketName, asset: AssetName, userAccount: UserAccount, marginCalculationState: {
94
94
  oracle_prices: OraclePrices;
95
95
  perp_prices: PerpPrices;
96
96
  margin_config: MarginConfig;
97
97
  }): Decimal;
98
- calculateLiquidationRiskPercentage(userAccount: UserAccount, MarginCalculationState: {
98
+ calculateLiquidationRiskPercentage(userAccount: UserAccount, marginCalculationState: {
99
99
  oracle_prices: OraclePrices;
100
100
  perp_prices: PerpPrices;
101
101
  margin_config: MarginConfig;
102
102
  }): Decimal;
103
- calculateMarginBalance(userAccount: UserAccount, MarginCalculationState: {
103
+ calculateMarginBalance(userAccount: UserAccount, marginCalculationState: {
104
104
  oracle_prices: OraclePrices;
105
105
  perp_prices: PerpPrices;
106
106
  margin_config: MarginConfig;
107
107
  }): Decimal;
108
- calculateForceCancelRiskPercentage(userAccount: UserAccount, MarginCalculationState: {
108
+ calculateForceCancelRiskPercentage(userAccount: UserAccount, marginCalculationState: {
109
109
  oracle_prices: OraclePrices;
110
110
  perp_prices: PerpPrices;
111
111
  margin_config: MarginConfig;
112
112
  }): Decimal;
113
- calculateMaxBorrowAmount(asset: AssetName, userAccount: UserAccount, MarginCalculationState: {
113
+ calculateMaxBorrowAmount(asset: AssetName, userAccount: UserAccount, marginCalculationState: {
114
114
  oracle_prices: OraclePrices;
115
115
  perp_prices: PerpPrices;
116
116
  margin_config: MarginConfig;
117
117
  }): Decimal;
118
- calculateMaxOrderSize(market: MarketName, price: Decimal, side: Side, order_type: OrderType, reduce_only: boolean, userAccount: UserAccount, MarginCalculationState: {
118
+ calculateMaxOrderSize(market: MarketName, price: Decimal, side: Side, order_type: OrderType, reduce_only: boolean, userAccount: UserAccount, marginCalculationState: {
119
119
  oracle_prices: OraclePrices;
120
120
  perp_prices: PerpPrices;
121
121
  margin_config: MarginConfig;
122
122
  }, orderbook: OrderbookL2, n_iterations?: number, error_tolerance?: Decimal): Decimal;
123
- simulateUsedMarginOnBorrow(asset: AssetName, borrowAmount: Decimal, userAccount: UserAccount, marginType: MarginType, MarginCalculationState: {
123
+ simulateUsedMarginOnBorrow(asset: AssetName, borrowAmount: Decimal, userAccount: UserAccount, marginType: MarginType, marginCalculationState: {
124
124
  oracle_prices: OraclePrices;
125
125
  perp_prices: PerpPrices;
126
126
  margin_config: MarginConfig;
@@ -128,7 +128,7 @@ export declare class ExchangeConnection extends BaseConnection {
128
128
  current: Decimal;
129
129
  updated: Decimal;
130
130
  };
131
- simulateUsedMarginOnOrder(market: MarketName, newOrderArgs: NewOrderArgs, userAccount: UserAccount, MarginCalculationState: {
131
+ simulateUsedMarginOnOrder(market: MarketName, newOrderArgs: NewOrderArgs, userAccount: UserAccount, marginCalculationState: {
132
132
  oracle_prices: OraclePrices;
133
133
  perp_prices: PerpPrices;
134
134
  margin_config: MarginConfig;
@@ -136,7 +136,7 @@ export declare class ExchangeConnection extends BaseConnection {
136
136
  current: Decimal;
137
137
  updated: Decimal;
138
138
  };
139
- simulateEstimatedLiquidationPriceOnOrder(market: MarketName, newOrderArgs: NewOrderArgs, baseAsset: AssetName, userAccount: UserAccount, MarginCalculationState: {
139
+ simulateEstimatedLiquidationPriceOnOrder(market: MarketName, newOrderArgs: NewOrderArgs, baseAsset: AssetName, userAccount: UserAccount, marginCalculationState: {
140
140
  oracle_prices: OraclePrices;
141
141
  perp_prices: PerpPrices;
142
142
  margin_config: MarginConfig;
@@ -144,7 +144,7 @@ export declare class ExchangeConnection extends BaseConnection {
144
144
  current: Decimal;
145
145
  updated: Decimal;
146
146
  };
147
- calculatePositionsAdditionalMetadata(userAccount: UserAccount, MarginCalculationState: {
147
+ calculatePositionsAdditionalMetadata(userAccount: UserAccount, marginCalculationState: {
148
148
  oracle_prices: OraclePrices;
149
149
  perp_prices: PerpPrices;
150
150
  margin_config: MarginConfig;
@@ -160,7 +160,7 @@ export declare class ExchangeConnection extends BaseConnection {
160
160
  current_deposit_rate: Decimal;
161
161
  current_borrow_rate: Decimal;
162
162
  };
163
- calculateAccountSummaryBatch(userAccounts: UserAccount[], MarginCalculationState: {
163
+ calculateAccountSummaryBatch(userAccounts: UserAccount[], marginCalculationState: {
164
164
  oracle_prices: OraclePrices;
165
165
  perp_prices: PerpPrices;
166
166
  margin_config: MarginConfig;
@@ -9,7 +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
+ export type MarketKind = "perp" | "spot";
13
13
  export type Side = "Bid" | "Ask";
14
14
  export type TriggerDirection = "GreaterThanOrEqual" | "LessThanOrEqual";
15
15
  export type TriggerPriceCondition = "Mark" | "Oracle" | "LastTrade";
@@ -75,8 +75,8 @@ export declare class BulletError extends Error {
75
75
  shortMessage: string;
76
76
  verboseMessage: string;
77
77
  httpStatus?: number;
78
- responseData?: any;
79
- constructor(code: string, shortMessage: string, verboseMessage: string, originalError?: Error | undefined, httpStatus?: number, responseData?: any);
78
+ responseData?: unknown;
79
+ constructor(code: string, shortMessage: string, verboseMessage: string, originalError?: Error | undefined, httpStatus?: number, responseData?: unknown);
80
80
  static fromModuleError(error: unknown): BulletError;
81
81
  toJSON(): {
82
82
  name: string;
@@ -85,6 +85,6 @@ export declare class BulletError extends Error {
85
85
  shortMessage: string;
86
86
  verboseMessage: string;
87
87
  httpStatus: number | undefined;
88
- responseData: any;
88
+ responseData: unknown;
89
89
  };
90
90
  }
@@ -2106,43 +2106,43 @@ export declare const Schemas: {
2106
2106
  readonly MarketRegistry: z.ZodObject<{
2107
2107
  metas: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
2108
2108
  id: z.ZodNumber;
2109
- kind: z.ZodEnum<["Perp", "Spot"]>;
2109
+ kind: z.ZodEnum<["perp", "spot"]>;
2110
2110
  base_asset_id: z.ZodNumber;
2111
2111
  name: z.ZodString;
2112
2112
  }, "strip", z.ZodTypeAny, {
2113
2113
  name: string;
2114
2114
  id: number;
2115
2115
  base_asset_id: number;
2116
- kind: "Perp" | "Spot";
2116
+ kind: "perp" | "spot";
2117
2117
  }, {
2118
2118
  name: string;
2119
2119
  id: number;
2120
2120
  base_asset_id: number;
2121
- kind: "Perp" | "Spot";
2121
+ kind: "perp" | "spot";
2122
2122
  }>>, Map<number, {
2123
2123
  name: string;
2124
2124
  id: number;
2125
2125
  base_asset_id: number;
2126
- kind: "Perp" | "Spot";
2126
+ kind: "perp" | "spot";
2127
2127
  }>, Record<string, {
2128
2128
  name: string;
2129
2129
  id: number;
2130
2130
  base_asset_id: number;
2131
- kind: "Perp" | "Spot";
2131
+ kind: "perp" | "spot";
2132
2132
  }>>;
2133
2133
  }, "strip", z.ZodTypeAny, {
2134
2134
  metas: Map<number, {
2135
2135
  name: string;
2136
2136
  id: number;
2137
2137
  base_asset_id: number;
2138
- kind: "Perp" | "Spot";
2138
+ kind: "perp" | "spot";
2139
2139
  }>;
2140
2140
  }, {
2141
2141
  metas: Record<string, {
2142
2142
  name: string;
2143
2143
  id: number;
2144
2144
  base_asset_id: number;
2145
- kind: "Perp" | "Spot";
2145
+ kind: "perp" | "spot";
2146
2146
  }>;
2147
2147
  }>;
2148
2148
  };
@@ -2733,43 +2733,43 @@ export declare const ResponseSchemas: {
2733
2733
  value: z.ZodNullable<z.ZodObject<{
2734
2734
  metas: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
2735
2735
  id: z.ZodNumber;
2736
- kind: z.ZodEnum<["Perp", "Spot"]>;
2736
+ kind: z.ZodEnum<["perp", "spot"]>;
2737
2737
  base_asset_id: z.ZodNumber;
2738
2738
  name: z.ZodString;
2739
2739
  }, "strip", z.ZodTypeAny, {
2740
2740
  name: string;
2741
2741
  id: number;
2742
2742
  base_asset_id: number;
2743
- kind: "Perp" | "Spot";
2743
+ kind: "perp" | "spot";
2744
2744
  }, {
2745
2745
  name: string;
2746
2746
  id: number;
2747
2747
  base_asset_id: number;
2748
- kind: "Perp" | "Spot";
2748
+ kind: "perp" | "spot";
2749
2749
  }>>, Map<number, {
2750
2750
  name: string;
2751
2751
  id: number;
2752
2752
  base_asset_id: number;
2753
- kind: "Perp" | "Spot";
2753
+ kind: "perp" | "spot";
2754
2754
  }>, Record<string, {
2755
2755
  name: string;
2756
2756
  id: number;
2757
2757
  base_asset_id: number;
2758
- kind: "Perp" | "Spot";
2758
+ kind: "perp" | "spot";
2759
2759
  }>>;
2760
2760
  }, "strip", z.ZodTypeAny, {
2761
2761
  metas: Map<number, {
2762
2762
  name: string;
2763
2763
  id: number;
2764
2764
  base_asset_id: number;
2765
- kind: "Perp" | "Spot";
2765
+ kind: "perp" | "spot";
2766
2766
  }>;
2767
2767
  }, {
2768
2768
  metas: Record<string, {
2769
2769
  name: string;
2770
2770
  id: number;
2771
2771
  base_asset_id: number;
2772
- kind: "Perp" | "Spot";
2772
+ kind: "perp" | "spot";
2773
2773
  }>;
2774
2774
  }>>;
2775
2775
  }, "strip", z.ZodTypeAny, {
@@ -2778,7 +2778,7 @@ export declare const ResponseSchemas: {
2778
2778
  name: string;
2779
2779
  id: number;
2780
2780
  base_asset_id: number;
2781
- kind: "Perp" | "Spot";
2781
+ kind: "perp" | "spot";
2782
2782
  }>;
2783
2783
  } | null;
2784
2784
  }, {
@@ -2787,7 +2787,7 @@ export declare const ResponseSchemas: {
2787
2787
  name: string;
2788
2788
  id: number;
2789
2789
  base_asset_id: number;
2790
- kind: "Perp" | "Spot";
2790
+ kind: "perp" | "spot";
2791
2791
  }>;
2792
2792
  } | null;
2793
2793
  }>;
@@ -53,25 +53,25 @@ export declare const WsResponseSchemas: {
53
53
  u: number;
54
54
  }>;
55
55
  }, "strip", z.ZodTypeAny, {
56
- type: "snapshot" | "delta";
57
- topic: string;
58
- ts: number;
59
56
  data: {
60
57
  s: number;
61
58
  b: [string, import("decimal.js").Decimal][];
62
59
  a: [string, import("decimal.js").Decimal][];
63
60
  u: number;
64
61
  };
65
- }, {
66
62
  type: "snapshot" | "delta";
67
63
  topic: string;
68
64
  ts: number;
65
+ }, {
69
66
  data: {
70
67
  s: number;
71
68
  b: [string, string | number][];
72
69
  a: [string, string | number][];
73
70
  u: number;
74
71
  };
72
+ type: "snapshot" | "delta";
73
+ topic: string;
74
+ ts: number;
75
75
  }>;
76
76
  };
77
77
  export type WebSocketResponse = z.infer<typeof WsResponseSchemas.WebSocketResponse>;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/zetamarkets/bullet-sdk.git"
6
6
  },
7
- "version": "0.31.0-rc.0",
7
+ "version": "0.31.0-rc.1",
8
8
  "description": "Bullet SDK",
9
9
  "author": "@bulletxyz",
10
10
  "license": "Apache-2.0",