ccxt 4.3.80 → 4.3.82

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/js/src/bybit.js CHANGED
@@ -1212,6 +1212,21 @@ export default class bybit extends Exchange {
1212
1212
  const optionType = this.safeString(optionParts, 3);
1213
1213
  const datetime = this.convertExpireDate(expiry);
1214
1214
  const timestamp = this.parse8601(datetime);
1215
+ let amountPrecision = undefined;
1216
+ let pricePrecision = undefined;
1217
+ // hard coded amount and price precisions from fetchOptionMarkets
1218
+ if (base === 'BTC') {
1219
+ amountPrecision = this.parseNumber('0.01');
1220
+ pricePrecision = this.parseNumber('5');
1221
+ }
1222
+ else if (base === 'ETH') {
1223
+ amountPrecision = this.parseNumber('0.1');
1224
+ pricePrecision = this.parseNumber('0.1');
1225
+ }
1226
+ else if (base === 'SOL') {
1227
+ amountPrecision = this.parseNumber('1');
1228
+ pricePrecision = this.parseNumber('0.01');
1229
+ }
1215
1230
  return {
1216
1231
  'id': base + '-' + this.convertExpireDateToMarketIdDate(expiry) + '-' + strike + '-' + optionType,
1217
1232
  'symbol': base + '/' + quote + ':' + settle + '-' + expiry + '-' + strike + '-' + optionType,
@@ -1231,14 +1246,14 @@ export default class bybit extends Exchange {
1231
1246
  'option': true,
1232
1247
  'margin': false,
1233
1248
  'contract': true,
1234
- 'contractSize': undefined,
1249
+ 'contractSize': this.parseNumber('1'),
1235
1250
  'expiry': timestamp,
1236
1251
  'expiryDatetime': datetime,
1237
1252
  'optionType': (optionType === 'C') ? 'call' : 'put',
1238
1253
  'strike': this.parseNumber(strike),
1239
1254
  'precision': {
1240
- 'amount': undefined,
1241
- 'price': undefined,
1255
+ 'amount': amountPrecision,
1256
+ 'price': pricePrecision,
1242
1257
  },
1243
1258
  'limits': {
1244
1259
  'amount': {
@@ -1275,6 +1290,33 @@ export default class bybit extends Exchange {
1275
1290
  }
1276
1291
  return [subType, params];
1277
1292
  }
1293
+ getAmount(symbol, amount) {
1294
+ // some markets like options might not have the precision available
1295
+ // and we shouldn't crash in those cases
1296
+ const market = this.market(symbol);
1297
+ const emptyPrecisionAmount = (market['precision']['amount'] === undefined);
1298
+ const amountString = this.numberToString(amount);
1299
+ if (!emptyPrecisionAmount && (amountString !== '0')) {
1300
+ return this.amountToPrecision(symbol, amount);
1301
+ }
1302
+ return amountString;
1303
+ }
1304
+ getPrice(symbol, price) {
1305
+ const market = this.market(symbol);
1306
+ const emptyPrecisionPrice = (market['precision']['price'] === undefined);
1307
+ if (!emptyPrecisionPrice) {
1308
+ return this.priceToPrecision(symbol, price);
1309
+ }
1310
+ return price;
1311
+ }
1312
+ getCost(symbol, cost) {
1313
+ const market = this.market(symbol);
1314
+ const emptyPrecisionPrice = (market['precision']['price'] === undefined);
1315
+ if (!emptyPrecisionPrice) {
1316
+ return this.costToPrecision(symbol, cost);
1317
+ }
1318
+ return cost;
1319
+ }
1278
1320
  async fetchTime(params = {}) {
1279
1321
  /**
1280
1322
  * @method
@@ -1899,7 +1941,7 @@ export default class bybit extends Exchange {
1899
1941
  'inverse': undefined,
1900
1942
  'taker': this.safeNumber(market, 'takerFee', this.parseNumber('0.0006')),
1901
1943
  'maker': this.safeNumber(market, 'makerFee', this.parseNumber('0.0001')),
1902
- 'contractSize': this.safeNumber(lotSizeFilter, 'minOrderQty'),
1944
+ 'contractSize': this.parseNumber('1'),
1903
1945
  'expiry': expiry,
1904
1946
  'expiryDatetime': this.iso8601(expiry),
1905
1947
  'strike': this.parseNumber(strike),
@@ -3665,27 +3707,29 @@ export default class bybit extends Exchange {
3665
3707
  const isLimit = lowerCaseType === 'limit';
3666
3708
  const isBuy = side === 'buy';
3667
3709
  const isAlternativeEndpoint = defaultMethod === 'privatePostV5PositionTradingStop';
3710
+ const amountString = this.getAmount(symbol, amount);
3711
+ const priceString = (price !== undefined) ? this.getPrice(symbol, this.numberToString(price)) : undefined;
3668
3712
  if (isTrailingAmountOrder || isAlternativeEndpoint) {
3669
3713
  if (isStopLoss || isTakeProfit || isTriggerOrder || market['spot']) {
3670
3714
  throw new InvalidOrder(this.id + ' the API endpoint used only supports contract trailingAmount, stopLossPrice and takeProfitPrice orders');
3671
3715
  }
3672
3716
  if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
3673
3717
  if (isStopLossTriggerOrder) {
3674
- request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
3718
+ request['stopLoss'] = this.getPrice(symbol, stopLossTriggerPrice);
3675
3719
  if (isLimit) {
3676
3720
  request['tpslMode'] = 'Partial';
3677
3721
  request['slOrderType'] = 'Limit';
3678
- request['slLimitPrice'] = this.priceToPrecision(symbol, price);
3679
- request['slSize'] = this.amountToPrecision(symbol, amount);
3722
+ request['slLimitPrice'] = priceString;
3723
+ request['slSize'] = amountString;
3680
3724
  }
3681
3725
  }
3682
3726
  else if (isTakeProfitTriggerOrder) {
3683
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
3727
+ request['takeProfit'] = this.getPrice(symbol, takeProfitTriggerPrice);
3684
3728
  if (isLimit) {
3685
3729
  request['tpslMode'] = 'Partial';
3686
3730
  request['tpOrderType'] = 'Limit';
3687
- request['tpLimitPrice'] = this.priceToPrecision(symbol, price);
3688
- request['tpSize'] = this.amountToPrecision(symbol, amount);
3731
+ request['tpLimitPrice'] = priceString;
3732
+ request['tpSize'] = amountString;
3689
3733
  }
3690
3734
  }
3691
3735
  }
@@ -3726,7 +3770,7 @@ export default class bybit extends Exchange {
3726
3770
  request['orderLinkId'] = this.uuid16();
3727
3771
  }
3728
3772
  if (isLimit) {
3729
- request['price'] = this.priceToPrecision(symbol, price);
3773
+ request['price'] = priceString;
3730
3774
  }
3731
3775
  }
3732
3776
  if (market['spot']) {
@@ -3754,16 +3798,14 @@ export default class bybit extends Exchange {
3754
3798
  orderCost = cost;
3755
3799
  }
3756
3800
  else {
3757
- const amountString = this.numberToString(amount);
3758
- const priceString = this.numberToString(price);
3759
3801
  const quoteAmount = Precise.stringMul(amountString, priceString);
3760
3802
  orderCost = quoteAmount;
3761
3803
  }
3762
- request['qty'] = this.costToPrecision(symbol, orderCost);
3804
+ request['qty'] = this.getCost(symbol, orderCost);
3763
3805
  }
3764
3806
  else {
3765
3807
  request['marketUnit'] = 'baseCoin';
3766
- request['qty'] = this.amountToPrecision(symbol, amount);
3808
+ request['qty'] = amountString;
3767
3809
  }
3768
3810
  }
3769
3811
  else if (market['spot'] && (type === 'market') && (side === 'buy')) {
@@ -3776,30 +3818,23 @@ export default class bybit extends Exchange {
3776
3818
  throw new InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
3777
3819
  }
3778
3820
  else {
3779
- const amountString = this.numberToString(amount);
3780
- const priceString = this.numberToString(price);
3781
3821
  const quoteAmount = Precise.stringMul(amountString, priceString);
3782
3822
  const costRequest = (cost !== undefined) ? cost : quoteAmount;
3783
- request['qty'] = this.costToPrecision(symbol, costRequest);
3823
+ request['qty'] = this.getCost(symbol, costRequest);
3784
3824
  }
3785
3825
  }
3786
3826
  else {
3787
- request['qty'] = this.costToPrecision(symbol, amount);
3827
+ request['qty'] = this.getCost(symbol, this.numberToString(amount));
3788
3828
  }
3789
3829
  }
3790
3830
  else {
3791
3831
  if (!isTrailingAmountOrder && !isAlternativeEndpoint) {
3792
- if (market['option']) {
3793
- request['qty'] = this.numberToString(amount);
3794
- }
3795
- else {
3796
- request['qty'] = this.amountToPrecision(symbol, amount);
3797
- }
3832
+ request['qty'] = amountString;
3798
3833
  }
3799
3834
  }
3800
3835
  if (isTrailingAmountOrder) {
3801
3836
  if (trailingTriggerPrice !== undefined) {
3802
- request['activePrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
3837
+ request['activePrice'] = this.getPrice(symbol, trailingTriggerPrice);
3803
3838
  }
3804
3839
  request['trailingStop'] = trailingAmount;
3805
3840
  }
@@ -3818,7 +3853,7 @@ export default class bybit extends Exchange {
3818
3853
  const isAsending = ((triggerDirection === 'above') || (triggerDirection === '1'));
3819
3854
  request['triggerDirection'] = isAsending ? 1 : 2;
3820
3855
  }
3821
- request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
3856
+ request['triggerPrice'] = this.getPrice(symbol, triggerPrice);
3822
3857
  }
3823
3858
  else if ((isStopLossTriggerOrder || isTakeProfitTriggerOrder) && !isAlternativeEndpoint) {
3824
3859
  if (isBuy) {
@@ -3828,28 +3863,28 @@ export default class bybit extends Exchange {
3828
3863
  request['triggerDirection'] = isStopLossTriggerOrder ? 2 : 1;
3829
3864
  }
3830
3865
  triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
3831
- request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
3866
+ request['triggerPrice'] = this.getPrice(symbol, triggerPrice);
3832
3867
  request['reduceOnly'] = true;
3833
3868
  }
3834
3869
  if ((isStopLoss || isTakeProfit) && !isAlternativeEndpoint) {
3835
3870
  if (isStopLoss) {
3836
3871
  const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
3837
- request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
3872
+ request['stopLoss'] = this.getPrice(symbol, slTriggerPrice);
3838
3873
  const slLimitPrice = this.safeValue(stopLoss, 'price');
3839
3874
  if (slLimitPrice !== undefined) {
3840
3875
  request['tpslMode'] = 'Partial';
3841
3876
  request['slOrderType'] = 'Limit';
3842
- request['slLimitPrice'] = this.priceToPrecision(symbol, slLimitPrice);
3877
+ request['slLimitPrice'] = this.getPrice(symbol, slLimitPrice);
3843
3878
  }
3844
3879
  }
3845
3880
  if (isTakeProfit) {
3846
3881
  const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
3847
- request['takeProfit'] = this.priceToPrecision(symbol, tpTriggerPrice);
3882
+ request['takeProfit'] = this.getPrice(symbol, tpTriggerPrice);
3848
3883
  const tpLimitPrice = this.safeValue(takeProfit, 'price');
3849
3884
  if (tpLimitPrice !== undefined) {
3850
3885
  request['tpslMode'] = 'Partial';
3851
3886
  request['tpOrderType'] = 'Limit';
3852
- request['tpLimitPrice'] = this.priceToPrecision(symbol, tpLimitPrice);
3887
+ request['tpLimitPrice'] = this.getPrice(symbol, tpLimitPrice);
3853
3888
  }
3854
3889
  }
3855
3890
  }
@@ -3960,7 +3995,7 @@ export default class bybit extends Exchange {
3960
3995
  'side': this.capitalize(side),
3961
3996
  'orderType': this.capitalize(lowerCaseType),
3962
3997
  'timeInForce': 'GoodTillCancel',
3963
- 'orderQty': this.amountToPrecision(symbol, amount),
3998
+ 'orderQty': this.getAmount(symbol, amount),
3964
3999
  // 'takeProfit': 123.45, // take profit price, only take effect upon opening the position
3965
4000
  // 'stopLoss': 123.45, // stop loss price, only take effect upon opening the position
3966
4001
  // 'reduceOnly': false, // reduce only, required for linear orders
@@ -3978,7 +4013,7 @@ export default class bybit extends Exchange {
3978
4013
  const isMarket = lowerCaseType === 'market';
3979
4014
  const isLimit = lowerCaseType === 'limit';
3980
4015
  if (isLimit !== undefined) {
3981
- request['orderPrice'] = this.priceToPrecision(symbol, price);
4016
+ request['orderPrice'] = this.getPrice(symbol, this.numberToString(price));
3982
4017
  }
3983
4018
  const exchangeSpecificParam = this.safeString(params, 'time_in_force');
3984
4019
  const timeInForce = this.safeStringLower(params, 'timeInForce');
@@ -4010,7 +4045,7 @@ export default class bybit extends Exchange {
4010
4045
  request['orderFilter'] = 'StopOrder';
4011
4046
  request['trigger_by'] = 'LastPrice';
4012
4047
  const stopPx = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
4013
- const preciseStopPrice = this.priceToPrecision(symbol, stopPx);
4048
+ const preciseStopPrice = this.getPrice(symbol, stopPx);
4014
4049
  request['triggerPrice'] = preciseStopPrice;
4015
4050
  const delta = this.numberToString(market['precision']['price']);
4016
4051
  request['basePrice'] = isStopLossTriggerOrder ? Precise.stringSub(preciseStopPrice, delta) : Precise.stringAdd(preciseStopPrice, delta);
@@ -4018,11 +4053,11 @@ export default class bybit extends Exchange {
4018
4053
  else if (isStopLoss || isTakeProfit) {
4019
4054
  if (isStopLoss) {
4020
4055
  const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
4021
- request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
4056
+ request['stopLoss'] = this.getPrice(symbol, slTriggerPrice);
4022
4057
  }
4023
4058
  if (isTakeProfit) {
4024
4059
  const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
4025
- request['takeProfit'] = this.priceToPrecision(symbol, tpTriggerPrice);
4060
+ request['takeProfit'] = this.getPrice(symbol, tpTriggerPrice);
4026
4061
  }
4027
4062
  }
4028
4063
  else {
@@ -4081,10 +4116,10 @@ export default class bybit extends Exchange {
4081
4116
  'orderId': id,
4082
4117
  };
4083
4118
  if (amount !== undefined) {
4084
- request['orderQty'] = this.amountToPrecision(symbol, amount);
4119
+ request['orderQty'] = this.getAmount(symbol, amount);
4085
4120
  }
4086
4121
  if (price !== undefined) {
4087
- request['orderPrice'] = this.priceToPrecision(symbol, price);
4122
+ request['orderPrice'] = this.getPrice(symbol, price);
4088
4123
  }
4089
4124
  let response = undefined;
4090
4125
  if (market['option']) {
@@ -4101,13 +4136,13 @@ export default class bybit extends Exchange {
4101
4136
  if (isStopOrder) {
4102
4137
  request['orderFilter'] = isStop ? 'StopOrder' : 'Order';
4103
4138
  if (triggerPrice !== undefined) {
4104
- request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
4139
+ request['triggerPrice'] = this.getPrice(symbol, triggerPrice);
4105
4140
  }
4106
4141
  if (stopLossPrice !== undefined) {
4107
- request['stopLoss'] = this.priceToPrecision(symbol, stopLossPrice);
4142
+ request['stopLoss'] = this.getPrice(symbol, stopLossPrice);
4108
4143
  }
4109
4144
  if (takeProfitPrice !== undefined) {
4110
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfitPrice);
4145
+ request['takeProfit'] = this.getPrice(symbol, takeProfitPrice);
4111
4146
  }
4112
4147
  }
4113
4148
  params = this.omit(params, ['stop', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
@@ -4157,13 +4192,10 @@ export default class bybit extends Exchange {
4157
4192
  request['category'] = 'option';
4158
4193
  }
4159
4194
  if (amount !== undefined) {
4160
- request['qty'] = this.amountToPrecision(symbol, amount);
4195
+ request['qty'] = this.getAmount(symbol, amount);
4161
4196
  }
4162
4197
  if (price !== undefined) {
4163
- request['price'] = this.priceToPrecision(symbol, price);
4164
- }
4165
- if (amount !== undefined) {
4166
- request['qty'] = this.amountToPrecision(symbol, amount);
4198
+ request['price'] = this.getPrice(symbol, this.numberToString(price));
4167
4199
  }
4168
4200
  let triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
4169
4201
  const stopLossTriggerPrice = this.safeString(params, 'stopLossPrice');
@@ -4178,7 +4210,7 @@ export default class bybit extends Exchange {
4178
4210
  triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
4179
4211
  }
4180
4212
  if (triggerPrice !== undefined) {
4181
- const triggerPriceRequest = (triggerPrice === '0') ? triggerPrice : this.priceToPrecision(symbol, triggerPrice);
4213
+ const triggerPriceRequest = (triggerPrice === '0') ? triggerPrice : this.getPrice(symbol, triggerPrice);
4182
4214
  request['triggerPrice'] = triggerPriceRequest;
4183
4215
  const triggerBy = this.safeString(params, 'triggerBy', 'LastPrice');
4184
4216
  request['triggerBy'] = triggerBy;
@@ -4186,14 +4218,14 @@ export default class bybit extends Exchange {
4186
4218
  if (isStopLoss || isTakeProfit) {
4187
4219
  if (isStopLoss) {
4188
4220
  const slTriggerPrice = this.safeString2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
4189
- const stopLossRequest = (slTriggerPrice === '0') ? slTriggerPrice : this.priceToPrecision(symbol, slTriggerPrice);
4221
+ const stopLossRequest = (slTriggerPrice === '0') ? slTriggerPrice : this.getPrice(symbol, slTriggerPrice);
4190
4222
  request['stopLoss'] = stopLossRequest;
4191
4223
  const slTriggerBy = this.safeString(params, 'slTriggerBy', 'LastPrice');
4192
4224
  request['slTriggerBy'] = slTriggerBy;
4193
4225
  }
4194
4226
  if (isTakeProfit) {
4195
4227
  const tpTriggerPrice = this.safeString2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
4196
- const takeProfitRequest = (tpTriggerPrice === '0') ? tpTriggerPrice : this.priceToPrecision(symbol, tpTriggerPrice);
4228
+ const takeProfitRequest = (tpTriggerPrice === '0') ? tpTriggerPrice : this.getPrice(symbol, tpTriggerPrice);
4197
4229
  request['takeProfit'] = takeProfitRequest;
4198
4230
  const tpTriggerBy = this.safeString(params, 'tpTriggerBy', 'LastPrice');
4199
4231
  request['tpTriggerBy'] = tpTriggerBy;
@@ -4234,10 +4266,10 @@ export default class bybit extends Exchange {
4234
4266
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4235
4267
  */
4236
4268
  await this.loadMarkets();
4269
+ const market = this.market(symbol);
4237
4270
  if (symbol === undefined) {
4238
4271
  throw new ArgumentsRequired(this.id + ' editOrder() requires a symbol argument');
4239
4272
  }
4240
- const market = this.market(symbol);
4241
4273
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4242
4274
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
4243
4275
  const isUsdcSettled = market['settle'] === 'USDC';
@@ -6172,6 +6204,8 @@ export default class bybit extends Exchange {
6172
6204
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
6173
6205
  */
6174
6206
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
6207
+ let accountType = undefined;
6208
+ [accountType, params] = this.handleOptionAndParams(params, 'withdraw', 'accountType', 'SPOT');
6175
6209
  await this.loadMarkets();
6176
6210
  this.checkAddress(address);
6177
6211
  const currency = this.currency(code);
@@ -6180,6 +6214,7 @@ export default class bybit extends Exchange {
6180
6214
  'amount': this.numberToString(amount),
6181
6215
  'address': address,
6182
6216
  'timestamp': this.milliseconds(),
6217
+ 'accountType': accountType,
6183
6218
  };
6184
6219
  if (tag !== undefined) {
6185
6220
  request['tag'] = tag;
@@ -66,7 +66,7 @@ export default class coinbaseexchange extends Exchange {
66
66
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
67
67
  createDepositAddress(code: string, params?: {}): Promise<{
68
68
  currency: string;
69
- address: any;
69
+ address: string;
70
70
  tag: string;
71
71
  info: any;
72
72
  }>;
@@ -1,7 +1,3 @@
1
1
  export * as hash from './utils/hash/index.js';
2
2
  export * from './utils/calldata/index.js';
3
3
  export * as typedData from './utils/typedData.js';
4
- /**
5
- * Deprecated
6
- */
7
- /** @deprecated prefer the 'num' naming */
@@ -7,44 +7,3 @@
7
7
  export * as hash from './utils/hash/index.js';
8
8
  export * from './utils/calldata/index.js';
9
9
  export * as typedData from './utils/typedData.js';
10
- // /**
11
- // * Main
12
- // */
13
- // export * from './account/index.js';
14
- // export * from './contract/index.js';
15
- // export * from './types/index.js';
16
- // /**
17
- // * Utils
18
- // */
19
- // export * as constants from './constants.js';
20
- // export * as encode from './utils/encode.js';
21
- // export * as v3hash from './utils/hash/transactionHash/v3.js';
22
- // export * as v2hash from './utils/hash/transactionHash/v2.js';
23
- // export * as num from './utils/num.js';
24
- // export * as transaction from './utils/transaction.js';
25
- // export * as stark from './utils/stark.js';
26
- // export * as eth from './utils/eth.js';
27
- // export * as merkle from './utils/merkle.js';
28
- // export * as uint256 from './utils/uint256.js';
29
- // export * as shortString from './utils/shortString.js';
30
- // export * as starknetId from './utils/starknetId.js';
31
- // export * as events from './utils/events/index.js';
32
- // export * from './utils/cairoDataTypes/uint256.js';
33
- // export * from './utils/cairoDataTypes/uint512.js';
34
- // export * from './utils/address.js';
35
- // export * from './utils/url.js';
36
- // export * from './utils/calldata/enum/index.js';
37
- // export * from './utils/contract.js';
38
- // export * from './utils/transactionReceipt.js';
39
- /**
40
- * Deprecated
41
- */
42
- /* eslint-disable import/first */
43
- // import * as num from './utils/num/index.js';
44
- /** @deprecated prefer the 'num' naming */
45
- // export const number = num;
46
- // export * from './utils/events/index.js';
47
- // export * as types from './types/index.js';
48
- // export * as json from './utils/json.js';
49
- // export * as provider from './utils/provider.js';
50
- // export * as selector from './utils/selector/index.js';
@@ -13,7 +13,6 @@ import { CallData } from '../calldata/index.js';
13
13
  import { felt } from '../calldata/cairo.js';
14
14
  import { pedersen, poseidonHash, keccak } from '../../../scure-starknet/index.js';
15
15
  import { addHexPrefix, utf8ToArray } from '../encode.js';
16
- import { parse, stringify } from '../json.js';
17
16
  import { toHex } from '../num.js';
18
17
  import { encodeShortString, isString } from '../shortString.js';
19
18
  export function computePedersenHash(a, b) {
@@ -91,7 +90,7 @@ export function formatSpaces(json) {
91
90
  export default function computeHintedClassHash(compiledContract) {
92
91
  const { abi, program } = compiledContract;
93
92
  const contractClass = { abi, program };
94
- const serializedJson = formatSpaces(stringify(contractClass, nullSkipReplacer));
93
+ const serializedJson = formatSpaces(JSON.stringify(contractClass, nullSkipReplacer));
95
94
  return addHexPrefix(keccak(utf8ToArray(serializedJson)).toString(16));
96
95
  }
97
96
  /**
@@ -100,7 +99,7 @@ export default function computeHintedClassHash(compiledContract) {
100
99
  */
101
100
  export function computeLegacyContractClassHash(contract) {
102
101
  const compiledContract = isString(contract)
103
- ? parse(contract)
102
+ ? JSON.parse(contract)
104
103
  : contract;
105
104
  const apiVersion = toHex(API_VERSION);
106
105
  const externalEntryPointsHash = computeHashOnElements(compiledContract.entry_points_by_type.EXTERNAL.flatMap((e) => [e.selector, e.offset]));
@@ -181,7 +180,7 @@ function hashEntryPointSierra(data) {
181
180
  return poseidonHashMany(base);
182
181
  }
183
182
  function hashAbi(sierra) {
184
- const indentString = formatSpaces(stringify(sierra.abi, null));
183
+ const indentString = formatSpaces(JSON.stringify(sierra.abi, null));
185
184
  return BigInt(addHexPrefix(keccak(utf8ToArray(indentString)).toString(16)));
186
185
  }
187
186
  /**
@@ -216,7 +215,7 @@ export function computeSierraContractClassHash(sierra) {
216
215
  * @returns format: hex-string
217
216
  */
218
217
  export function computeContractClassHash(contract) {
219
- const compiledContract = isString(contract) ? parse(contract) : contract;
218
+ const compiledContract = isString(contract) ? JSON.parse(contract) : contract;
220
219
  if ('sierra_program' in compiledContract) {
221
220
  return computeSierraContractClassHash(compiledContract);
222
221
  }
@@ -1302,7 +1302,8 @@ export default class wavesexchange extends Exchange {
1302
1302
  throw new InvalidOrder(this.id + ' createOrder() requires a price argument for ' + type + ' orders to determine the max price for buy and the min price for sell');
1303
1303
  }
1304
1304
  const timestamp = this.milliseconds();
1305
- const defaultExpiryDelta = this.safeInteger(this.options, 'createOrderDefaultExpiry', 2419200000);
1305
+ let defaultExpiryDelta = undefined;
1306
+ [defaultExpiryDelta, params] = this.handleOptionAndParams(params, 'createOrder', 'defaultExpiry', this.safeInteger(this.options, 'createOrderDefaultExpiry', 2419200000));
1306
1307
  const expiration = this.sum(timestamp, defaultExpiryDelta);
1307
1308
  const matcherFees = await this.getFeesForAsset(symbol, side, amount, price);
1308
1309
  // {
@@ -1450,12 +1451,12 @@ export default class wavesexchange extends Exchange {
1450
1451
  // }
1451
1452
  //
1452
1453
  if (isMarketOrder) {
1453
- const response = await this.matcherPostMatcherOrderbookMarket(body);
1454
+ const response = await this.matcherPostMatcherOrderbookMarket(this.extend(body, params));
1454
1455
  const value = this.safeDict(response, 'message');
1455
1456
  return this.parseOrder(value, market);
1456
1457
  }
1457
1458
  else {
1458
- const response = await this.matcherPostMatcherOrderbook(body);
1459
+ const response = await this.matcherPostMatcherOrderbook(this.extend(body, params));
1459
1460
  const value = this.safeDict(response, 'message');
1460
1461
  return this.parseOrder(value, market);
1461
1462
  }
package/js/src/yobit.js CHANGED
@@ -240,6 +240,7 @@ export default class yobit extends Exchange {
240
240
  'XIN': 'XINCoin',
241
241
  'XMT': 'SummitCoin',
242
242
  'XRA': 'Ratecoin',
243
+ 'BCHN': 'BSV',
243
244
  },
244
245
  'options': {
245
246
  'maxUrlLength': 2048,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.80",
3
+ "version": "4.3.82",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",