@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/browser/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({
|
|
@@ -9528,7 +9540,7 @@ var Client = class _Client {
|
|
|
9528
9540
|
});
|
|
9529
9541
|
}
|
|
9530
9542
|
async amendOrder(options) {
|
|
9531
|
-
const marketId =
|
|
9543
|
+
const marketId = this.exchange.getMarketId(
|
|
9532
9544
|
options.placeOrderArgs.market
|
|
9533
9545
|
);
|
|
9534
9546
|
return await this.submitTransaction({
|
|
@@ -9594,10 +9606,12 @@ var Client = class _Client {
|
|
|
9594
9606
|
return await this.submitTransaction({
|
|
9595
9607
|
exchange: {
|
|
9596
9608
|
cancel_orders: {
|
|
9597
|
-
args: [
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9609
|
+
args: [
|
|
9610
|
+
{
|
|
9611
|
+
order_id: orderId?.toString() ?? null,
|
|
9612
|
+
client_order_id: clientOrderId?.toString() ?? null
|
|
9613
|
+
}
|
|
9614
|
+
]
|
|
9601
9615
|
}
|
|
9602
9616
|
}
|
|
9603
9617
|
});
|
|
@@ -9637,7 +9651,7 @@ var Client = class _Client {
|
|
|
9637
9651
|
update_mark_prices: {
|
|
9638
9652
|
prices_to_update: await Promise.all(
|
|
9639
9653
|
pricesToUpdate.map(async ({ market, medianCexPrice, diffEma }) => ({
|
|
9640
|
-
market_id:
|
|
9654
|
+
market_id: this.exchange.getMarketId(market),
|
|
9641
9655
|
median_cex_price: BulletWasm.convert_rust_decimal_to_json(
|
|
9642
9656
|
medianCexPrice.toFixed()
|
|
9643
9657
|
),
|
|
@@ -9655,7 +9669,7 @@ var Client = class _Client {
|
|
|
9655
9669
|
if (!Number.isInteger(maxLeverage)) {
|
|
9656
9670
|
throw Error("Max leverage must be set to an integer");
|
|
9657
9671
|
}
|
|
9658
|
-
const marketId =
|
|
9672
|
+
const marketId = this.exchange.getMarketId(market);
|
|
9659
9673
|
return await this.submitTransaction({
|
|
9660
9674
|
exchange: {
|
|
9661
9675
|
update_market_max_leverage: {
|
|
@@ -9668,7 +9682,7 @@ var Client = class _Client {
|
|
|
9668
9682
|
async updatePremiumIndexes(markets) {
|
|
9669
9683
|
const marketIds = await Promise.all(
|
|
9670
9684
|
markets.map(async (market) => {
|
|
9671
|
-
return
|
|
9685
|
+
return this.exchange.getMarketId(market);
|
|
9672
9686
|
})
|
|
9673
9687
|
);
|
|
9674
9688
|
return await this.submitTransaction({
|
|
@@ -9688,7 +9702,7 @@ var Client = class _Client {
|
|
|
9688
9702
|
async updateFunding(markets) {
|
|
9689
9703
|
const marketIds = await Promise.all(
|
|
9690
9704
|
markets.map(async (market) => {
|
|
9691
|
-
return
|
|
9705
|
+
return this.exchange.getMarketId(market);
|
|
9692
9706
|
})
|
|
9693
9707
|
);
|
|
9694
9708
|
return await this.submitTransaction({
|
|
@@ -9723,7 +9737,7 @@ var Client = class _Client {
|
|
|
9723
9737
|
async liquidatePerpPositions(address, positions) {
|
|
9724
9738
|
const positionsWithIds = positions ? await Promise.all(
|
|
9725
9739
|
positions.map(async ({ market, size }) => ({
|
|
9726
|
-
market_id:
|
|
9740
|
+
market_id: this.exchange.getMarketId(market),
|
|
9727
9741
|
size: BulletWasm.convert_rust_decimal_to_json(size.toFixed())
|
|
9728
9742
|
}))
|
|
9729
9743
|
) : null;
|