@bulletxyz/bullet-sdk 0.26.0 → 0.26.2
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 +28 -14
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +28 -14
- package/dist/node/index.js.map +2 -2
- package/dist/types/client.d.ts +48 -0
- package/dist/types/exchange.d.ts +1 -1
- package/dist/types/zod-types/rest.d.ts +2085 -271
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -7581,12 +7581,14 @@ var BorrowLendRiskConfig = z.object({
|
|
|
7581
7581
|
liability_liquidation_limit_ratio: DecimalSchema,
|
|
7582
7582
|
asset_weight: DecimalSchema,
|
|
7583
7583
|
initial_liability_weight: DecimalSchema,
|
|
7584
|
-
maintenance_liability_weight: DecimalSchema
|
|
7584
|
+
maintenance_liability_weight: DecimalSchema,
|
|
7585
|
+
protocol_reward_ratio: DecimalSchema
|
|
7585
7586
|
});
|
|
7586
7587
|
var PerpLiquidationConfig = z.object({
|
|
7587
7588
|
liquidation_ioc_buffer: DecimalSchema,
|
|
7588
7589
|
backstop_liquidation_threshold: DecimalSchema,
|
|
7589
|
-
liquidation_fee: DecimalSchema
|
|
7590
|
+
liquidation_fee: DecimalSchema,
|
|
7591
|
+
liquidation_protocol_reward_ratio: DecimalSchema
|
|
7590
7592
|
});
|
|
7591
7593
|
var SpotLedger = z.object({
|
|
7592
7594
|
asset: DecimalSchema,
|
|
@@ -7633,12 +7635,15 @@ var Tpsl = z.object({
|
|
|
7633
7635
|
size: DecimalSchema.nullable(),
|
|
7634
7636
|
order_type: z.enum(ORDER_TYPES),
|
|
7635
7637
|
owner: Base58Address,
|
|
7638
|
+
last_update_timestamp: UnixTimestampMillis,
|
|
7636
7639
|
linked_tpsl_order_id: OrderId.nullable()
|
|
7637
7640
|
});
|
|
7641
|
+
var FeeTier = z.enum(["Tier0", "Tier1", "Tier2", "Tier3", "Tier4"]);
|
|
7638
7642
|
var PerpLedger = z.object({
|
|
7639
7643
|
orders: createJsonMap(OrderId, Order),
|
|
7640
7644
|
position: Position,
|
|
7641
7645
|
user_selected_max_leverage: U16Schema,
|
|
7646
|
+
fee_tier: FeeTier,
|
|
7642
7647
|
tpsls: createJsonMap(OrderId, Tpsl)
|
|
7643
7648
|
});
|
|
7644
7649
|
var TpslOrderIdsToExecute = z.array(TpslOrderId);
|
|
@@ -7663,10 +7668,14 @@ var Schemas = {
|
|
|
7663
7668
|
usdc_ledger: UsdcLedger,
|
|
7664
7669
|
client_order_ids: createJsonMap(ClientOrderId, OrderId),
|
|
7665
7670
|
spot_ledgers: createJsonMap(AssetId, SpotLedger),
|
|
7666
|
-
perp_ledgers: createJsonMap(MarketId, PerpLedger)
|
|
7671
|
+
perp_ledgers: createJsonMap(MarketId, PerpLedger),
|
|
7672
|
+
spot_orders: createJsonMap(MarketId, createJsonMap(OrderId, Order)),
|
|
7673
|
+
spot_tpsls: createJsonMap(MarketId, createJsonMap(TpslOrderId, Tpsl)),
|
|
7674
|
+
spot_fee_tiers: createJsonMap(MarketId, FeeTier)
|
|
7667
7675
|
}),
|
|
7668
7676
|
OraclePrices: z.object({
|
|
7669
7677
|
pricing_frequency_seconds: U32Schema,
|
|
7678
|
+
relaxed_pricing_frequency_seconds: U32Schema,
|
|
7670
7679
|
prices: createJsonMap(
|
|
7671
7680
|
AssetId,
|
|
7672
7681
|
z.object({
|
|
@@ -7696,11 +7705,14 @@ var Schemas = {
|
|
|
7696
7705
|
borrowed_amount: DecimalSchema,
|
|
7697
7706
|
cumulative_deposit_rate: DecimalSchema,
|
|
7698
7707
|
cumulative_borrow_rate: DecimalSchema,
|
|
7699
|
-
accumulated_protocol_fees: DecimalSchema
|
|
7708
|
+
accumulated_protocol_fees: DecimalSchema,
|
|
7709
|
+
unclaimed_protocol_fees: DecimalSchema,
|
|
7710
|
+
interest_fee_tenth_bps: z.number()
|
|
7700
7711
|
})
|
|
7701
7712
|
).nullable(),
|
|
7702
7713
|
PerpPrices: z.object({
|
|
7703
7714
|
pricing_frequency_seconds: U32Schema,
|
|
7715
|
+
relaxed_pricing_frequency_seconds: U32Schema,
|
|
7704
7716
|
mark_prices: createJsonMap(
|
|
7705
7717
|
MarketId,
|
|
7706
7718
|
z.object({
|
|
@@ -9542,7 +9554,7 @@ var Client = class _Client {
|
|
|
9542
9554
|
});
|
|
9543
9555
|
}
|
|
9544
9556
|
async amendOrder(options) {
|
|
9545
|
-
const marketId =
|
|
9557
|
+
const marketId = this.exchange.getMarketId(
|
|
9546
9558
|
options.placeOrderArgs.market
|
|
9547
9559
|
);
|
|
9548
9560
|
return await this.submitTransaction({
|
|
@@ -9608,10 +9620,12 @@ var Client = class _Client {
|
|
|
9608
9620
|
return await this.submitTransaction({
|
|
9609
9621
|
exchange: {
|
|
9610
9622
|
cancel_orders: {
|
|
9611
|
-
args: [
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9623
|
+
args: [
|
|
9624
|
+
{
|
|
9625
|
+
order_id: orderId?.toString() ?? null,
|
|
9626
|
+
client_order_id: clientOrderId?.toString() ?? null
|
|
9627
|
+
}
|
|
9628
|
+
]
|
|
9615
9629
|
}
|
|
9616
9630
|
}
|
|
9617
9631
|
});
|
|
@@ -9651,7 +9665,7 @@ var Client = class _Client {
|
|
|
9651
9665
|
update_mark_prices: {
|
|
9652
9666
|
prices_to_update: await Promise.all(
|
|
9653
9667
|
pricesToUpdate.map(async ({ market, medianCexPrice, diffEma }) => ({
|
|
9654
|
-
market_id:
|
|
9668
|
+
market_id: this.exchange.getMarketId(market),
|
|
9655
9669
|
median_cex_price: BulletWasm.convert_rust_decimal_to_json(
|
|
9656
9670
|
medianCexPrice.toFixed()
|
|
9657
9671
|
),
|
|
@@ -9669,7 +9683,7 @@ var Client = class _Client {
|
|
|
9669
9683
|
if (!Number.isInteger(maxLeverage)) {
|
|
9670
9684
|
throw Error("Max leverage must be set to an integer");
|
|
9671
9685
|
}
|
|
9672
|
-
const marketId =
|
|
9686
|
+
const marketId = this.exchange.getMarketId(market);
|
|
9673
9687
|
return await this.submitTransaction({
|
|
9674
9688
|
exchange: {
|
|
9675
9689
|
update_market_max_leverage: {
|
|
@@ -9682,7 +9696,7 @@ var Client = class _Client {
|
|
|
9682
9696
|
async updatePremiumIndexes(markets) {
|
|
9683
9697
|
const marketIds = await Promise.all(
|
|
9684
9698
|
markets.map(async (market) => {
|
|
9685
|
-
return
|
|
9699
|
+
return this.exchange.getMarketId(market);
|
|
9686
9700
|
})
|
|
9687
9701
|
);
|
|
9688
9702
|
return await this.submitTransaction({
|
|
@@ -9702,7 +9716,7 @@ var Client = class _Client {
|
|
|
9702
9716
|
async updateFunding(markets) {
|
|
9703
9717
|
const marketIds = await Promise.all(
|
|
9704
9718
|
markets.map(async (market) => {
|
|
9705
|
-
return
|
|
9719
|
+
return this.exchange.getMarketId(market);
|
|
9706
9720
|
})
|
|
9707
9721
|
);
|
|
9708
9722
|
return await this.submitTransaction({
|
|
@@ -9737,7 +9751,7 @@ var Client = class _Client {
|
|
|
9737
9751
|
async liquidatePerpPositions(address, positions) {
|
|
9738
9752
|
const positionsWithIds = positions ? await Promise.all(
|
|
9739
9753
|
positions.map(async ({ market, size }) => ({
|
|
9740
|
-
market_id:
|
|
9754
|
+
market_id: this.exchange.getMarketId(market),
|
|
9741
9755
|
size: BulletWasm.convert_rust_decimal_to_json(size.toFixed())
|
|
9742
9756
|
}))
|
|
9743
9757
|
) : null;
|