@bulletxyz/bullet-sdk 0.17.5-rc.2 → 0.17.5-rc.3

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.
@@ -2444,7 +2444,7 @@ function serialize(value) {
2444
2444
  return value;
2445
2445
  }
2446
2446
  if (decimal_default.isDecimal(value)) {
2447
- return value.toString();
2447
+ return value.toFixed();
2448
2448
  }
2449
2449
  if (typeof value === "bigint") {
2450
2450
  if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
@@ -6994,13 +6994,13 @@ var Orderbook = class _Orderbook {
6994
6994
  asset_id: orderbook.asset,
6995
6995
  bids: new Map(
6996
6996
  Array.from(orderbook.bids.entries()).map(([price, size]) => [
6997
- price.toString(),
6997
+ price.toFixed(),
6998
6998
  { order_ids: [], total_size: size }
6999
6999
  ])
7000
7000
  ),
7001
7001
  asks: new Map(
7002
7002
  Array.from(orderbook.asks.entries()).map(([price, size]) => [
7003
- price.toString(),
7003
+ price.toFixed(),
7004
7004
  { order_ids: [], total_size: size }
7005
7005
  ])
7006
7006
  )
@@ -9002,7 +9002,7 @@ var Client = class _Client {
9002
9002
  exchange: {
9003
9003
  deposit: {
9004
9004
  asset_id: asset,
9005
- amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
9005
+ amount: BulletWasm.convert_rust_decimal_to_json(amount.toFixed())
9006
9006
  }
9007
9007
  }
9008
9008
  });
@@ -9012,7 +9012,7 @@ var Client = class _Client {
9012
9012
  exchange: {
9013
9013
  withdraw: {
9014
9014
  asset_id: asset,
9015
- amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
9015
+ amount: BulletWasm.convert_rust_decimal_to_json(amount.toFixed())
9016
9016
  }
9017
9017
  }
9018
9018
  });
@@ -9022,7 +9022,7 @@ var Client = class _Client {
9022
9022
  exchange: {
9023
9023
  borrow_spot: {
9024
9024
  asset_id: asset,
9025
- amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
9025
+ amount: BulletWasm.convert_rust_decimal_to_json(amount.toFixed())
9026
9026
  }
9027
9027
  }
9028
9028
  });
@@ -9033,8 +9033,8 @@ var Client = class _Client {
9033
9033
  place_order: {
9034
9034
  order_args: {
9035
9035
  asset_id: asset,
9036
- price: BulletWasm.convert_rust_decimal_to_json(price.toString()),
9037
- size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
9036
+ price: BulletWasm.convert_rust_decimal_to_json(price.toFixed()),
9037
+ size: BulletWasm.convert_rust_decimal_to_json(size.toFixed()),
9038
9038
  side,
9039
9039
  order_type: orderType,
9040
9040
  reduce_only: reduceOnly
@@ -9049,14 +9049,14 @@ var Client = class _Client {
9049
9049
  orderType: orderType2
9050
9050
  }) => ({
9051
9051
  order_price: BulletWasm.convert_rust_decimal_to_json(
9052
- orderPrice.toString()
9052
+ orderPrice.toFixed()
9053
9053
  ),
9054
9054
  trigger_price: BulletWasm.convert_rust_decimal_to_json(
9055
- triggerPrice.toString()
9055
+ triggerPrice.toFixed()
9056
9056
  ),
9057
9057
  trigger_direction: triggerDirection,
9058
9058
  tpsl_price_condition: tpslPriceCondition,
9059
- size: BulletWasm.convert_rust_decimal_to_json(size2.toString()),
9059
+ size: BulletWasm.convert_rust_decimal_to_json(size2.toFixed()),
9060
9060
  order_type: orderType2
9061
9061
  })
9062
9062
  )
@@ -9079,14 +9079,14 @@ var Client = class _Client {
9079
9079
  orderType
9080
9080
  }) => ({
9081
9081
  order_price: BulletWasm.convert_rust_decimal_to_json(
9082
- orderPrice.toString()
9082
+ orderPrice.toFixed()
9083
9083
  ),
9084
9084
  trigger_price: BulletWasm.convert_rust_decimal_to_json(
9085
- triggerPrice.toString()
9085
+ triggerPrice.toFixed()
9086
9086
  ),
9087
9087
  trigger_direction: triggerDirection,
9088
9088
  tpsl_price_condition: tpslPriceCondition,
9089
- size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
9089
+ size: BulletWasm.convert_rust_decimal_to_json(size.toFixed()),
9090
9090
  order_type: orderType
9091
9091
  })
9092
9092
  )
@@ -9101,8 +9101,8 @@ var Client = class _Client {
9101
9101
  existing_order_id: existingOrderId.toString(),
9102
9102
  order_args: {
9103
9103
  asset_id: asset,
9104
- price: BulletWasm.convert_rust_decimal_to_json(price.toString()),
9105
- size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
9104
+ price: BulletWasm.convert_rust_decimal_to_json(price.toFixed()),
9105
+ size: BulletWasm.convert_rust_decimal_to_json(size.toFixed()),
9106
9106
  side,
9107
9107
  order_type: orderType,
9108
9108
  reduce_only: reduceOnly
@@ -9117,14 +9117,14 @@ var Client = class _Client {
9117
9117
  orderType: orderType2
9118
9118
  }) => ({
9119
9119
  order_price: BulletWasm.convert_rust_decimal_to_json(
9120
- orderPrice.toString()
9120
+ orderPrice.toFixed()
9121
9121
  ),
9122
9122
  trigger_price: BulletWasm.convert_rust_decimal_to_json(
9123
- triggerPrice.toString()
9123
+ triggerPrice.toFixed()
9124
9124
  ),
9125
9125
  trigger_direction: triggerDirection,
9126
9126
  tpsl_price_condition: tpslPriceCondition,
9127
- size: BulletWasm.convert_rust_decimal_to_json(size2.toString()),
9127
+ size: BulletWasm.convert_rust_decimal_to_json(size2.toFixed()),
9128
9128
  order_type: orderType2
9129
9129
  })
9130
9130
  )
@@ -9168,13 +9168,13 @@ var Client = class _Client {
9168
9168
  ({ asset, medianCexPrice, oraclePrice, diffEma }) => ({
9169
9169
  asset_id: asset,
9170
9170
  median_cex_price: BulletWasm.convert_rust_decimal_to_json(
9171
- medianCexPrice.toString()
9171
+ medianCexPrice.toFixed()
9172
9172
  ),
9173
9173
  oracle_price: BulletWasm.convert_rust_decimal_to_json(
9174
- oraclePrice.toString()
9174
+ oraclePrice.toFixed()
9175
9175
  ),
9176
9176
  diff_ema: BulletWasm.convert_rust_decimal_to_json(
9177
- diffEma.toString()
9177
+ diffEma.toFixed()
9178
9178
  )
9179
9179
  })
9180
9180
  ),
@@ -9238,7 +9238,7 @@ var Client = class _Client {
9238
9238
  address,
9239
9239
  positions: positions?.map(({ asset, size }) => ({
9240
9240
  asset_id: asset,
9241
- size: BulletWasm.convert_rust_decimal_to_json(size.toString())
9241
+ size: BulletWasm.convert_rust_decimal_to_json(size.toFixed())
9242
9242
  })) ?? null
9243
9243
  }
9244
9244
  }
@@ -9252,7 +9252,7 @@ var Client = class _Client {
9252
9252
  liability_asset_id: liabilityAssetId,
9253
9253
  collateral_asset_id: collateralAssetId,
9254
9254
  liability_amount: BulletWasm.convert_rust_decimal_to_json(
9255
- liabilityAmount.toString()
9255
+ liabilityAmount.toFixed()
9256
9256
  )
9257
9257
  }
9258
9258
  }
@@ -9263,7 +9263,7 @@ var Client = class _Client {
9263
9263
  exchange: {
9264
9264
  deposit_to_usdc_pnl_pool: {
9265
9265
  usdc_amount: BulletWasm.convert_rust_decimal_to_json(
9266
- amount.toString()
9266
+ amount.toFixed()
9267
9267
  )
9268
9268
  }
9269
9269
  }
@@ -9274,7 +9274,7 @@ var Client = class _Client {
9274
9274
  exchange: {
9275
9275
  deposit_to_insurance_fund: {
9276
9276
  usdc_amount: BulletWasm.convert_rust_decimal_to_json(
9277
- amount.toString()
9277
+ amount.toFixed()
9278
9278
  )
9279
9279
  }
9280
9280
  }
@@ -9501,12 +9501,12 @@ function calculateMaxOrderSize(assetId, side, price, reduceOnly, userAccount, ma
9501
9501
  userAccountObject,
9502
9502
  assetId,
9503
9503
  side === "Bid" ? Side.Bid : Side.Ask,
9504
- price.toString(),
9504
+ price.toFixed(),
9505
9505
  reduceOnly,
9506
9506
  marginContextObject,
9507
9507
  side === "Bid" ? makerBookObject.asks : makerBookObject.bids,
9508
9508
  n_iterations,
9509
- error_tolerance.toString()
9509
+ error_tolerance.toFixed()
9510
9510
  );
9511
9511
  return new decimal_default(result);
9512
9512
  }
@@ -9515,7 +9515,7 @@ function simulateUsedMarginOnBorrow(assetId, borrowAmount, userAccount, marginTy
9515
9515
  const marginContextObject = serialize(marginContext);
9516
9516
  const result = BulletWasm.simulate_used_margin_on_borrow(
9517
9517
  assetId,
9518
- borrowAmount.toString(),
9518
+ borrowAmount.toFixed(),
9519
9519
  userAccountObject,
9520
9520
  marginType,
9521
9521
  marginContextObject