@bulletxyz/bullet-sdk 0.17.3-rc.0 → 0.17.3-rc.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 -27
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.js +28 -27
- package/dist/node/index.js.map +2 -2
- package/dist/types/types.d.ts +2 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -2419,7 +2419,7 @@ function serialize(value) {
|
|
|
2419
2419
|
return value;
|
|
2420
2420
|
}
|
|
2421
2421
|
if (value instanceof decimal_default) {
|
|
2422
|
-
return value.
|
|
2422
|
+
return value.toString();
|
|
2423
2423
|
}
|
|
2424
2424
|
if (typeof value === "bigint") {
|
|
2425
2425
|
if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
@@ -8267,6 +8267,7 @@ var Asset = /* @__PURE__ */ ((Asset3) => {
|
|
|
8267
8267
|
Asset3[Asset3["BERA"] = 14] = "BERA";
|
|
8268
8268
|
Asset3[Asset3["TIA"] = 15] = "TIA";
|
|
8269
8269
|
Asset3[Asset3["ZEX"] = 16] = "ZEX";
|
|
8270
|
+
Asset3[Asset3["JLP"] = 17] = "JLP";
|
|
8270
8271
|
return Asset3;
|
|
8271
8272
|
})(Asset || {});
|
|
8272
8273
|
var BulletError = class _BulletError extends Error {
|
|
@@ -8925,7 +8926,7 @@ var Client = class _Client {
|
|
|
8925
8926
|
exchange: {
|
|
8926
8927
|
deposit: {
|
|
8927
8928
|
asset_id: asset,
|
|
8928
|
-
amount: BulletWasm.convert_rust_decimal_to_json(amount.
|
|
8929
|
+
amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
|
|
8929
8930
|
}
|
|
8930
8931
|
}
|
|
8931
8932
|
});
|
|
@@ -8935,7 +8936,7 @@ var Client = class _Client {
|
|
|
8935
8936
|
exchange: {
|
|
8936
8937
|
withdraw: {
|
|
8937
8938
|
asset_id: asset,
|
|
8938
|
-
amount: BulletWasm.convert_rust_decimal_to_json(amount.
|
|
8939
|
+
amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
|
|
8939
8940
|
}
|
|
8940
8941
|
}
|
|
8941
8942
|
});
|
|
@@ -8945,7 +8946,7 @@ var Client = class _Client {
|
|
|
8945
8946
|
exchange: {
|
|
8946
8947
|
borrow_spot: {
|
|
8947
8948
|
asset_id: asset,
|
|
8948
|
-
amount: BulletWasm.convert_rust_decimal_to_json(amount.
|
|
8949
|
+
amount: BulletWasm.convert_rust_decimal_to_json(amount.toString())
|
|
8949
8950
|
}
|
|
8950
8951
|
}
|
|
8951
8952
|
});
|
|
@@ -8956,8 +8957,8 @@ var Client = class _Client {
|
|
|
8956
8957
|
place_order: {
|
|
8957
8958
|
order_args: {
|
|
8958
8959
|
asset_id: asset,
|
|
8959
|
-
price: BulletWasm.convert_rust_decimal_to_json(price.
|
|
8960
|
-
size: BulletWasm.convert_rust_decimal_to_json(size.
|
|
8960
|
+
price: BulletWasm.convert_rust_decimal_to_json(price.toString()),
|
|
8961
|
+
size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
|
|
8961
8962
|
side,
|
|
8962
8963
|
order_type: orderType,
|
|
8963
8964
|
reduce_only: reduceOnly
|
|
@@ -8972,14 +8973,14 @@ var Client = class _Client {
|
|
|
8972
8973
|
orderType: orderType2
|
|
8973
8974
|
}) => ({
|
|
8974
8975
|
order_price: BulletWasm.convert_rust_decimal_to_json(
|
|
8975
|
-
orderPrice.
|
|
8976
|
+
orderPrice.toString()
|
|
8976
8977
|
),
|
|
8977
8978
|
trigger_price: BulletWasm.convert_rust_decimal_to_json(
|
|
8978
|
-
triggerPrice.
|
|
8979
|
+
triggerPrice.toString()
|
|
8979
8980
|
),
|
|
8980
8981
|
trigger_direction: triggerDirection,
|
|
8981
8982
|
tpsl_price_condition: tpslPriceCondition,
|
|
8982
|
-
size: BulletWasm.convert_rust_decimal_to_json(size2.
|
|
8983
|
+
size: BulletWasm.convert_rust_decimal_to_json(size2.toString()),
|
|
8983
8984
|
order_type: orderType2
|
|
8984
8985
|
})
|
|
8985
8986
|
)
|
|
@@ -9002,14 +9003,14 @@ var Client = class _Client {
|
|
|
9002
9003
|
orderType
|
|
9003
9004
|
}) => ({
|
|
9004
9005
|
order_price: BulletWasm.convert_rust_decimal_to_json(
|
|
9005
|
-
orderPrice.
|
|
9006
|
+
orderPrice.toString()
|
|
9006
9007
|
),
|
|
9007
9008
|
trigger_price: BulletWasm.convert_rust_decimal_to_json(
|
|
9008
|
-
triggerPrice.
|
|
9009
|
+
triggerPrice.toString()
|
|
9009
9010
|
),
|
|
9010
9011
|
trigger_direction: triggerDirection,
|
|
9011
9012
|
tpsl_price_condition: tpslPriceCondition,
|
|
9012
|
-
size: BulletWasm.convert_rust_decimal_to_json(size.
|
|
9013
|
+
size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
|
|
9013
9014
|
order_type: orderType
|
|
9014
9015
|
})
|
|
9015
9016
|
)
|
|
@@ -9024,8 +9025,8 @@ var Client = class _Client {
|
|
|
9024
9025
|
existing_order_id: existingOrderId.toString(),
|
|
9025
9026
|
order_args: {
|
|
9026
9027
|
asset_id: asset,
|
|
9027
|
-
price: BulletWasm.convert_rust_decimal_to_json(price.
|
|
9028
|
-
size: BulletWasm.convert_rust_decimal_to_json(size.
|
|
9028
|
+
price: BulletWasm.convert_rust_decimal_to_json(price.toString()),
|
|
9029
|
+
size: BulletWasm.convert_rust_decimal_to_json(size.toString()),
|
|
9029
9030
|
side,
|
|
9030
9031
|
order_type: orderType,
|
|
9031
9032
|
reduce_only: reduceOnly
|
|
@@ -9040,14 +9041,14 @@ var Client = class _Client {
|
|
|
9040
9041
|
orderType: orderType2
|
|
9041
9042
|
}) => ({
|
|
9042
9043
|
order_price: BulletWasm.convert_rust_decimal_to_json(
|
|
9043
|
-
orderPrice.
|
|
9044
|
+
orderPrice.toString()
|
|
9044
9045
|
),
|
|
9045
9046
|
trigger_price: BulletWasm.convert_rust_decimal_to_json(
|
|
9046
|
-
triggerPrice.
|
|
9047
|
+
triggerPrice.toString()
|
|
9047
9048
|
),
|
|
9048
9049
|
trigger_direction: triggerDirection,
|
|
9049
9050
|
tpsl_price_condition: tpslPriceCondition,
|
|
9050
|
-
size: BulletWasm.convert_rust_decimal_to_json(size2.
|
|
9051
|
+
size: BulletWasm.convert_rust_decimal_to_json(size2.toString()),
|
|
9051
9052
|
order_type: orderType2
|
|
9052
9053
|
})
|
|
9053
9054
|
)
|
|
@@ -9093,13 +9094,13 @@ var Client = class _Client {
|
|
|
9093
9094
|
({ asset, medianCexPrice, oraclePrice, diffEma }) => ({
|
|
9094
9095
|
asset_id: asset,
|
|
9095
9096
|
median_cex_price: BulletWasm.convert_rust_decimal_to_json(
|
|
9096
|
-
medianCexPrice.
|
|
9097
|
+
medianCexPrice.toString()
|
|
9097
9098
|
),
|
|
9098
9099
|
oracle_price: BulletWasm.convert_rust_decimal_to_json(
|
|
9099
|
-
oraclePrice.
|
|
9100
|
+
oraclePrice.toString()
|
|
9100
9101
|
),
|
|
9101
9102
|
diff_ema: BulletWasm.convert_rust_decimal_to_json(
|
|
9102
|
-
diffEma.
|
|
9103
|
+
diffEma.toString()
|
|
9103
9104
|
)
|
|
9104
9105
|
})
|
|
9105
9106
|
),
|
|
@@ -9163,7 +9164,7 @@ var Client = class _Client {
|
|
|
9163
9164
|
address: base58ToBytes(address),
|
|
9164
9165
|
positions: positions?.map(({ asset, size }) => ({
|
|
9165
9166
|
asset_id: asset,
|
|
9166
|
-
size: BulletWasm.convert_rust_decimal_to_json(size.
|
|
9167
|
+
size: BulletWasm.convert_rust_decimal_to_json(size.toString())
|
|
9167
9168
|
})) ?? null
|
|
9168
9169
|
}
|
|
9169
9170
|
}
|
|
@@ -9177,7 +9178,7 @@ var Client = class _Client {
|
|
|
9177
9178
|
liability_asset_id: liabilityAssetId,
|
|
9178
9179
|
collateral_asset_id: collateralAssetId,
|
|
9179
9180
|
liability_amount: BulletWasm.convert_rust_decimal_to_json(
|
|
9180
|
-
liabilityAmount.
|
|
9181
|
+
liabilityAmount.toString()
|
|
9181
9182
|
)
|
|
9182
9183
|
}
|
|
9183
9184
|
}
|
|
@@ -9188,7 +9189,7 @@ var Client = class _Client {
|
|
|
9188
9189
|
exchange: {
|
|
9189
9190
|
deposit_to_usdc_pnl_pool: {
|
|
9190
9191
|
usdc_amount: BulletWasm.convert_rust_decimal_to_json(
|
|
9191
|
-
amount.
|
|
9192
|
+
amount.toString()
|
|
9192
9193
|
)
|
|
9193
9194
|
}
|
|
9194
9195
|
}
|
|
@@ -9199,7 +9200,7 @@ var Client = class _Client {
|
|
|
9199
9200
|
exchange: {
|
|
9200
9201
|
deposit_to_insurance_fund: {
|
|
9201
9202
|
usdc_amount: BulletWasm.convert_rust_decimal_to_json(
|
|
9202
|
-
amount.
|
|
9203
|
+
amount.toString()
|
|
9203
9204
|
)
|
|
9204
9205
|
}
|
|
9205
9206
|
}
|
|
@@ -9348,12 +9349,12 @@ function calculateMaxOrderSize(assetId, side, price, reduceOnly, userAccount, ma
|
|
|
9348
9349
|
userAccountObject,
|
|
9349
9350
|
assetId,
|
|
9350
9351
|
side === "Bid" ? Side.Bid : Side.Ask,
|
|
9351
|
-
price.
|
|
9352
|
+
price.toString(),
|
|
9352
9353
|
reduceOnly,
|
|
9353
9354
|
marginContextObject,
|
|
9354
9355
|
side == "Bid" ? makerBook.asks : makerBook.bids,
|
|
9355
9356
|
n_iterations,
|
|
9356
|
-
error_tolerance.
|
|
9357
|
+
error_tolerance.toString()
|
|
9357
9358
|
);
|
|
9358
9359
|
return new decimal_default(result);
|
|
9359
9360
|
}
|
|
@@ -9362,7 +9363,7 @@ function simulateUsedMarginOnBorrow(assetId, borrowAmount, userAccount, marginTy
|
|
|
9362
9363
|
const marginContextObject = serialize(marginContext);
|
|
9363
9364
|
const result = BulletWasm.simulate_used_margin_on_borrow(
|
|
9364
9365
|
assetId,
|
|
9365
|
-
borrowAmount.
|
|
9366
|
+
borrowAmount.toString(),
|
|
9366
9367
|
userAccountObject,
|
|
9367
9368
|
marginType,
|
|
9368
9369
|
marginContextObject
|