@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
  )
@@ -8988,7 +8988,7 @@ var Client = class _Client {
8988
8988
  exchange: {
8989
8989
  deposit: {
8990
8990
  asset_id: asset,
8991
- amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
8991
+ amount: BulletWasm.convert_rust_decimal_to_json(amount.toFixed())
8992
8992
  }
8993
8993
  }
8994
8994
  });
@@ -8998,7 +8998,7 @@ var Client = class _Client {
8998
8998
  exchange: {
8999
8999
  withdraw: {
9000
9000
  asset_id: asset,
9001
- amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
9001
+ amount: BulletWasm.convert_rust_decimal_to_json(amount.toFixed())
9002
9002
  }
9003
9003
  }
9004
9004
  });
@@ -9008,7 +9008,7 @@ var Client = class _Client {
9008
9008
  exchange: {
9009
9009
  borrow_spot: {
9010
9010
  asset_id: asset,
9011
- amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
9011
+ amount: BulletWasm.convert_rust_decimal_to_json(amount.toFixed())
9012
9012
  }
9013
9013
  }
9014
9014
  });
@@ -9019,8 +9019,8 @@ var Client = class _Client {
9019
9019
  place_order: {
9020
9020
  order_args: {
9021
9021
  asset_id: asset,
9022
- price: BulletWasm.convert_rust_decimal_to_json(price.toString()),
9023
- size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
9022
+ price: BulletWasm.convert_rust_decimal_to_json(price.toFixed()),
9023
+ size: BulletWasm.convert_rust_decimal_to_json(size.toFixed()),
9024
9024
  side,
9025
9025
  order_type: orderType,
9026
9026
  reduce_only: reduceOnly
@@ -9035,14 +9035,14 @@ var Client = class _Client {
9035
9035
  orderType: orderType2
9036
9036
  }) => ({
9037
9037
  order_price: BulletWasm.convert_rust_decimal_to_json(
9038
- orderPrice.toString()
9038
+ orderPrice.toFixed()
9039
9039
  ),
9040
9040
  trigger_price: BulletWasm.convert_rust_decimal_to_json(
9041
- triggerPrice.toString()
9041
+ triggerPrice.toFixed()
9042
9042
  ),
9043
9043
  trigger_direction: triggerDirection,
9044
9044
  tpsl_price_condition: tpslPriceCondition,
9045
- size: BulletWasm.convert_rust_decimal_to_json(size2.toString()),
9045
+ size: BulletWasm.convert_rust_decimal_to_json(size2.toFixed()),
9046
9046
  order_type: orderType2
9047
9047
  })
9048
9048
  )
@@ -9065,14 +9065,14 @@ var Client = class _Client {
9065
9065
  orderType
9066
9066
  }) => ({
9067
9067
  order_price: BulletWasm.convert_rust_decimal_to_json(
9068
- orderPrice.toString()
9068
+ orderPrice.toFixed()
9069
9069
  ),
9070
9070
  trigger_price: BulletWasm.convert_rust_decimal_to_json(
9071
- triggerPrice.toString()
9071
+ triggerPrice.toFixed()
9072
9072
  ),
9073
9073
  trigger_direction: triggerDirection,
9074
9074
  tpsl_price_condition: tpslPriceCondition,
9075
- size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
9075
+ size: BulletWasm.convert_rust_decimal_to_json(size.toFixed()),
9076
9076
  order_type: orderType
9077
9077
  })
9078
9078
  )
@@ -9087,8 +9087,8 @@ var Client = class _Client {
9087
9087
  existing_order_id: existingOrderId.toString(),
9088
9088
  order_args: {
9089
9089
  asset_id: asset,
9090
- price: BulletWasm.convert_rust_decimal_to_json(price.toString()),
9091
- size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
9090
+ price: BulletWasm.convert_rust_decimal_to_json(price.toFixed()),
9091
+ size: BulletWasm.convert_rust_decimal_to_json(size.toFixed()),
9092
9092
  side,
9093
9093
  order_type: orderType,
9094
9094
  reduce_only: reduceOnly
@@ -9103,14 +9103,14 @@ var Client = class _Client {
9103
9103
  orderType: orderType2
9104
9104
  }) => ({
9105
9105
  order_price: BulletWasm.convert_rust_decimal_to_json(
9106
- orderPrice.toString()
9106
+ orderPrice.toFixed()
9107
9107
  ),
9108
9108
  trigger_price: BulletWasm.convert_rust_decimal_to_json(
9109
- triggerPrice.toString()
9109
+ triggerPrice.toFixed()
9110
9110
  ),
9111
9111
  trigger_direction: triggerDirection,
9112
9112
  tpsl_price_condition: tpslPriceCondition,
9113
- size: BulletWasm.convert_rust_decimal_to_json(size2.toString()),
9113
+ size: BulletWasm.convert_rust_decimal_to_json(size2.toFixed()),
9114
9114
  order_type: orderType2
9115
9115
  })
9116
9116
  )
@@ -9154,13 +9154,13 @@ var Client = class _Client {
9154
9154
  ({ asset, medianCexPrice, oraclePrice, diffEma }) => ({
9155
9155
  asset_id: asset,
9156
9156
  median_cex_price: BulletWasm.convert_rust_decimal_to_json(
9157
- medianCexPrice.toString()
9157
+ medianCexPrice.toFixed()
9158
9158
  ),
9159
9159
  oracle_price: BulletWasm.convert_rust_decimal_to_json(
9160
- oraclePrice.toString()
9160
+ oraclePrice.toFixed()
9161
9161
  ),
9162
9162
  diff_ema: BulletWasm.convert_rust_decimal_to_json(
9163
- diffEma.toString()
9163
+ diffEma.toFixed()
9164
9164
  )
9165
9165
  })
9166
9166
  ),
@@ -9224,7 +9224,7 @@ var Client = class _Client {
9224
9224
  address,
9225
9225
  positions: positions?.map(({ asset, size }) => ({
9226
9226
  asset_id: asset,
9227
- size: BulletWasm.convert_rust_decimal_to_json(size.toString())
9227
+ size: BulletWasm.convert_rust_decimal_to_json(size.toFixed())
9228
9228
  })) ?? null
9229
9229
  }
9230
9230
  }
@@ -9238,7 +9238,7 @@ var Client = class _Client {
9238
9238
  liability_asset_id: liabilityAssetId,
9239
9239
  collateral_asset_id: collateralAssetId,
9240
9240
  liability_amount: BulletWasm.convert_rust_decimal_to_json(
9241
- liabilityAmount.toString()
9241
+ liabilityAmount.toFixed()
9242
9242
  )
9243
9243
  }
9244
9244
  }
@@ -9249,7 +9249,7 @@ var Client = class _Client {
9249
9249
  exchange: {
9250
9250
  deposit_to_usdc_pnl_pool: {
9251
9251
  usdc_amount: BulletWasm.convert_rust_decimal_to_json(
9252
- amount.toString()
9252
+ amount.toFixed()
9253
9253
  )
9254
9254
  }
9255
9255
  }
@@ -9260,7 +9260,7 @@ var Client = class _Client {
9260
9260
  exchange: {
9261
9261
  deposit_to_insurance_fund: {
9262
9262
  usdc_amount: BulletWasm.convert_rust_decimal_to_json(
9263
- amount.toString()
9263
+ amount.toFixed()
9264
9264
  )
9265
9265
  }
9266
9266
  }
@@ -9420,12 +9420,12 @@ function calculateMaxOrderSize(assetId, side, price, reduceOnly, userAccount, ma
9420
9420
  userAccountObject,
9421
9421
  assetId,
9422
9422
  side === "Bid" ? Side.Bid : Side.Ask,
9423
- price.toString(),
9423
+ price.toFixed(),
9424
9424
  reduceOnly,
9425
9425
  marginContextObject,
9426
9426
  side === "Bid" ? makerBookObject.asks : makerBookObject.bids,
9427
9427
  n_iterations,
9428
- error_tolerance.toString()
9428
+ error_tolerance.toFixed()
9429
9429
  );
9430
9430
  return new decimal_default(result);
9431
9431
  }
@@ -9434,7 +9434,7 @@ function simulateUsedMarginOnBorrow(assetId, borrowAmount, userAccount, marginTy
9434
9434
  const marginContextObject = serialize(marginContext);
9435
9435
  const result = BulletWasm.simulate_used_margin_on_borrow(
9436
9436
  assetId,
9437
- borrowAmount.toString(),
9437
+ borrowAmount.toFixed(),
9438
9438
  userAccountObject,
9439
9439
  marginType,
9440
9440
  marginContextObject