ccxt 4.5.49 → 4.5.51

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.
Files changed (998) hide show
  1. package/README.md +5 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/abstract/aftermath.js +1 -1
  5. package/dist/cjs/src/abstract/alpaca.js +1 -1
  6. package/dist/cjs/src/abstract/apex.js +1 -1
  7. package/dist/cjs/src/abstract/arkham.js +1 -1
  8. package/dist/cjs/src/abstract/ascendex.js +1 -1
  9. package/dist/cjs/src/abstract/aster.js +1 -1
  10. package/dist/cjs/src/abstract/backpack.js +1 -1
  11. package/dist/cjs/src/abstract/bigone.js +1 -1
  12. package/dist/cjs/src/abstract/binance.js +1 -1
  13. package/dist/cjs/src/abstract/bingx.js +1 -1
  14. package/dist/cjs/src/abstract/bit2c.js +1 -1
  15. package/dist/cjs/src/abstract/bitbank.js +1 -1
  16. package/dist/cjs/src/abstract/bitbns.js +1 -1
  17. package/dist/cjs/src/abstract/bitfinex.js +1 -1
  18. package/dist/cjs/src/abstract/bitflyer.js +1 -1
  19. package/dist/cjs/src/abstract/bitget.js +1 -1
  20. package/dist/cjs/src/abstract/bithumb.js +1 -1
  21. package/dist/cjs/src/abstract/bitmart.js +1 -1
  22. package/dist/cjs/src/abstract/bitmex.js +1 -1
  23. package/dist/cjs/src/abstract/bitopro.js +1 -1
  24. package/dist/cjs/src/abstract/bitrue.js +1 -1
  25. package/dist/cjs/src/abstract/bitso.js +1 -1
  26. package/dist/cjs/src/abstract/bitstamp.js +1 -1
  27. package/dist/cjs/src/abstract/bitteam.js +1 -1
  28. package/dist/cjs/src/abstract/bittrade.js +1 -1
  29. package/dist/cjs/src/abstract/bitvavo.js +1 -1
  30. package/dist/cjs/src/abstract/blockchaincom.js +1 -1
  31. package/dist/cjs/src/abstract/blofin.js +1 -1
  32. package/dist/cjs/src/abstract/btcbox.js +1 -1
  33. package/dist/cjs/src/abstract/btcmarkets.js +1 -1
  34. package/dist/cjs/src/abstract/btcturk.js +1 -1
  35. package/dist/cjs/src/abstract/bullish.js +1 -1
  36. package/dist/cjs/src/abstract/bybit.js +1 -1
  37. package/dist/cjs/src/abstract/bydfi.js +1 -1
  38. package/dist/cjs/src/abstract/cex.js +1 -1
  39. package/dist/cjs/src/abstract/coinbase.js +1 -1
  40. package/dist/cjs/src/abstract/coinbaseexchange.js +1 -1
  41. package/dist/cjs/src/abstract/coinbaseinternational.js +1 -1
  42. package/dist/cjs/src/abstract/coincheck.js +1 -1
  43. package/dist/cjs/src/abstract/coinex.js +1 -1
  44. package/dist/cjs/src/abstract/coinmate.js +1 -1
  45. package/dist/cjs/src/abstract/coinmetro.js +1 -1
  46. package/dist/cjs/src/abstract/coinone.js +1 -1
  47. package/dist/cjs/src/abstract/coinsph.js +1 -1
  48. package/dist/cjs/src/abstract/coinspot.js +1 -1
  49. package/dist/cjs/src/abstract/cryptocom.js +1 -1
  50. package/dist/cjs/src/abstract/cryptomus.js +1 -1
  51. package/dist/cjs/src/abstract/deepcoin.js +1 -1
  52. package/dist/cjs/src/abstract/delta.js +1 -1
  53. package/dist/cjs/src/abstract/deribit.js +1 -1
  54. package/dist/cjs/src/abstract/derive.js +1 -1
  55. package/dist/cjs/src/abstract/digifinex.js +1 -1
  56. package/dist/cjs/src/abstract/dydx.js +1 -1
  57. package/dist/cjs/src/abstract/exmo.js +1 -1
  58. package/dist/cjs/src/abstract/foxbit.js +1 -1
  59. package/dist/cjs/src/abstract/gate.js +1 -1
  60. package/dist/cjs/src/abstract/gemini.js +1 -1
  61. package/dist/cjs/src/abstract/grvt.js +1 -1
  62. package/dist/cjs/src/abstract/hashkey.js +1 -1
  63. package/dist/cjs/src/abstract/hibachi.js +1 -1
  64. package/dist/cjs/src/abstract/hitbtc.js +1 -1
  65. package/dist/cjs/src/abstract/hollaex.js +1 -1
  66. package/dist/cjs/src/abstract/htx.js +1 -1
  67. package/dist/cjs/src/abstract/hyperliquid.js +1 -1
  68. package/dist/cjs/src/abstract/independentreserve.js +1 -1
  69. package/dist/cjs/src/abstract/indodax.js +1 -1
  70. package/dist/cjs/src/abstract/kraken.js +1 -1
  71. package/dist/cjs/src/abstract/krakenfutures.js +1 -1
  72. package/dist/cjs/src/abstract/kucoin.js +1 -1
  73. package/dist/cjs/src/abstract/latoken.js +1 -1
  74. package/dist/cjs/src/abstract/lbank.js +1 -1
  75. package/dist/cjs/src/abstract/lighter.js +1 -1
  76. package/dist/cjs/src/abstract/luno.js +1 -1
  77. package/dist/cjs/src/abstract/mercado.js +1 -1
  78. package/dist/cjs/src/abstract/mexc.js +1 -1
  79. package/dist/cjs/src/abstract/modetrade.js +1 -1
  80. package/dist/cjs/src/abstract/ndax.js +1 -1
  81. package/dist/cjs/src/abstract/novadax.js +1 -1
  82. package/dist/cjs/src/abstract/okx.js +1 -1
  83. package/dist/cjs/src/abstract/onetrading.js +1 -1
  84. package/dist/cjs/src/abstract/oxfun.js +1 -1
  85. package/dist/cjs/src/abstract/p2b.js +1 -1
  86. package/dist/cjs/src/abstract/pacifica.js +1 -1
  87. package/dist/cjs/src/abstract/paradex.js +1 -1
  88. package/dist/cjs/src/abstract/paymium.js +1 -1
  89. package/dist/cjs/src/abstract/phemex.js +1 -1
  90. package/dist/cjs/src/abstract/poloniex.js +1 -1
  91. package/dist/cjs/src/abstract/tokocrypto.js +1 -1
  92. package/dist/cjs/src/abstract/toobit.js +1 -1
  93. package/dist/cjs/src/abstract/upbit.js +1 -1
  94. package/dist/cjs/src/abstract/wavesexchange.js +1 -1
  95. package/dist/cjs/src/abstract/weex.js +1 -1
  96. package/dist/cjs/src/abstract/whitebit.js +1 -1
  97. package/dist/cjs/src/abstract/woo.js +1 -1
  98. package/dist/cjs/src/abstract/woofipro.js +1 -1
  99. package/dist/cjs/src/abstract/xt.js +1 -1
  100. package/dist/cjs/src/abstract/yobit.js +1 -1
  101. package/dist/cjs/src/abstract/zaif.js +1 -1
  102. package/dist/cjs/src/abstract/zebpay.js +1 -1
  103. package/dist/cjs/src/abstract/zonda.js +1 -1
  104. package/dist/cjs/src/aftermath.js +0 -1
  105. package/dist/cjs/src/alpaca.js +1 -1
  106. package/dist/cjs/src/apex.js +1 -1
  107. package/dist/cjs/src/arkham.js +1 -1
  108. package/dist/cjs/src/ascendex.js +1 -1
  109. package/dist/cjs/src/aster.js +1 -1
  110. package/dist/cjs/src/backpack.js +1 -1
  111. package/dist/cjs/src/base/Exchange.js +51 -13
  112. package/dist/cjs/src/base/Precise.js +0 -6
  113. package/dist/cjs/src/base/errors.js +0 -6
  114. package/dist/cjs/src/base/functions/crypto.js +1 -1
  115. package/dist/cjs/src/base/functions/encode.js +1 -1
  116. package/dist/cjs/src/base/functions/io.js +1 -1
  117. package/dist/cjs/src/base/functions/misc.js +0 -1
  118. package/dist/cjs/src/base/functions/number.js +0 -6
  119. package/dist/cjs/src/base/functions/platform.js +0 -6
  120. package/dist/cjs/src/base/functions/rsa.js +0 -1
  121. package/dist/cjs/src/base/functions/string.js +0 -6
  122. package/dist/cjs/src/base/functions/throttle.js +1 -1
  123. package/dist/cjs/src/base/functions/time.js +0 -6
  124. package/dist/cjs/src/base/functions/totp.js +0 -1
  125. package/dist/cjs/src/base/functions/type.js +0 -6
  126. package/dist/cjs/src/base/functions.js +1 -1
  127. package/dist/cjs/src/base/ws/Cache.js +0 -6
  128. package/dist/cjs/src/base/ws/Client.js +0 -1
  129. package/dist/cjs/src/base/ws/Future.js +1 -1
  130. package/dist/cjs/src/base/ws/OrderBook.js +1 -1
  131. package/dist/cjs/src/base/ws/OrderBookSide.js +0 -6
  132. package/dist/cjs/src/base/ws/WsClient.js +1 -1
  133. package/dist/cjs/src/bequant.js +1 -1
  134. package/dist/cjs/src/bigone.js +1 -1
  135. package/dist/cjs/src/binance.js +23 -11
  136. package/dist/cjs/src/binancecoinm.js +1 -1
  137. package/dist/cjs/src/binanceus.js +1 -1
  138. package/dist/cjs/src/binanceusdm.js +1 -1
  139. package/dist/cjs/src/bingx.js +1 -1
  140. package/dist/cjs/src/bit2c.js +1 -1
  141. package/dist/cjs/src/bitbank.js +1 -1
  142. package/dist/cjs/src/bitbns.js +1 -1
  143. package/dist/cjs/src/bitfinex.js +1 -1
  144. package/dist/cjs/src/bitflyer.js +1 -1
  145. package/dist/cjs/src/bitget.js +7 -4
  146. package/dist/cjs/src/bithumb.js +1 -1
  147. package/dist/cjs/src/bitmart.js +1 -1
  148. package/dist/cjs/src/bitmex.js +1 -1
  149. package/dist/cjs/src/bitopro.js +1 -1
  150. package/dist/cjs/src/bitrue.js +1 -1
  151. package/dist/cjs/src/bitso.js +1 -1
  152. package/dist/cjs/src/bitstamp.js +1 -1
  153. package/dist/cjs/src/bitteam.js +1 -1
  154. package/dist/cjs/src/bittrade.js +1 -1
  155. package/dist/cjs/src/blockchaincom.js +1 -1
  156. package/dist/cjs/src/blofin.js +26 -31
  157. package/dist/cjs/src/btcbox.js +1 -1
  158. package/dist/cjs/src/btcmarkets.js +1 -1
  159. package/dist/cjs/src/btcturk.js +1 -1
  160. package/dist/cjs/src/bullish.js +1 -1
  161. package/dist/cjs/src/bybit.js +1 -1
  162. package/dist/cjs/src/bydfi.js +2 -3
  163. package/dist/cjs/src/cex.js +1 -1
  164. package/dist/cjs/src/coinbaseadvanced.js +1 -1
  165. package/dist/cjs/src/coincheck.js +1 -1
  166. package/dist/cjs/src/coinex.js +1 -1
  167. package/dist/cjs/src/coinmate.js +1 -1
  168. package/dist/cjs/src/coinmetro.js +1 -1
  169. package/dist/cjs/src/coinone.js +1 -1
  170. package/dist/cjs/src/coinsph.js +0 -1
  171. package/dist/cjs/src/coinspot.js +1 -1
  172. package/dist/cjs/src/cryptocom.js +1 -1
  173. package/dist/cjs/src/cryptomus.js +1 -1
  174. package/dist/cjs/src/deepcoin.js +1 -2
  175. package/dist/cjs/src/delta.js +1 -1
  176. package/dist/cjs/src/deribit.js +1 -1
  177. package/dist/cjs/src/derive.js +1 -1
  178. package/dist/cjs/src/digifinex.js +1 -1
  179. package/dist/cjs/src/dydx.js +1 -1
  180. package/dist/cjs/src/exmo.js +1 -1
  181. package/dist/cjs/src/fmfwio.js +1 -1
  182. package/dist/cjs/src/foxbit.js +1 -1
  183. package/dist/cjs/src/gate.js +1 -2
  184. package/dist/cjs/src/gateio.js +1 -1
  185. package/dist/cjs/src/gemini.js +1 -1
  186. package/dist/cjs/src/grvt.js +15 -15
  187. package/dist/cjs/src/hashkey.js +1 -1
  188. package/dist/cjs/src/hibachi.js +2 -2
  189. package/dist/cjs/src/hitbtc.js +0 -1
  190. package/dist/cjs/src/hollaex.js +1 -1
  191. package/dist/cjs/src/htx.js +1 -1
  192. package/dist/cjs/src/huobi.js +1 -1
  193. package/dist/cjs/src/hyperliquid.js +1 -1
  194. package/dist/cjs/src/independentreserve.js +1 -1
  195. package/dist/cjs/src/indodax.js +1 -1
  196. package/dist/cjs/src/kraken.js +1 -1
  197. package/dist/cjs/src/krakenfutures.js +1 -1
  198. package/dist/cjs/src/kucoin.js +246 -111
  199. package/dist/cjs/src/kucoinfutures.js +1 -2
  200. package/dist/cjs/src/latoken.js +1 -1
  201. package/dist/cjs/src/lbank.js +1 -1
  202. package/dist/cjs/src/lighter.js +313 -142
  203. package/dist/cjs/src/luno.js +1 -1
  204. package/dist/cjs/src/mercado.js +1 -1
  205. package/dist/cjs/src/mexc.js +1 -1
  206. package/dist/cjs/src/modetrade.js +1 -1
  207. package/dist/cjs/src/myokx.js +1 -1
  208. package/dist/cjs/src/ndax.js +1 -1
  209. package/dist/cjs/src/novadax.js +1 -1
  210. package/dist/cjs/src/okx.js +47 -2
  211. package/dist/cjs/src/okxus.js +1 -1
  212. package/dist/cjs/src/onetrading.js +1 -1
  213. package/dist/cjs/src/oxfun.js +1 -1
  214. package/dist/cjs/src/p2b.js +1 -1
  215. package/dist/cjs/src/pacifica.js +1 -1
  216. package/dist/cjs/src/paradex.js +1 -1
  217. package/dist/cjs/src/paymium.js +1 -1
  218. package/dist/cjs/src/poloniex.js +1 -1
  219. package/dist/cjs/src/pro/alpaca.js +1 -1
  220. package/dist/cjs/src/pro/apex.js +1 -1
  221. package/dist/cjs/src/pro/arkham.js +1 -1
  222. package/dist/cjs/src/pro/ascendex.js +1 -1
  223. package/dist/cjs/src/pro/aster.js +24 -43
  224. package/dist/cjs/src/pro/backpack.js +1 -1
  225. package/dist/cjs/src/pro/bequant.js +1 -1
  226. package/dist/cjs/src/pro/binance.js +1 -1
  227. package/dist/cjs/src/pro/binancecoinm.js +1 -1
  228. package/dist/cjs/src/pro/binanceus.js +1 -1
  229. package/dist/cjs/src/pro/binanceusdm.js +1 -1
  230. package/dist/cjs/src/pro/bingx.js +1 -1
  231. package/dist/cjs/src/pro/bitfinex.js +1 -1
  232. package/dist/cjs/src/pro/bitget.js +1 -1
  233. package/dist/cjs/src/pro/bithumb.js +1 -1
  234. package/dist/cjs/src/pro/bitmart.js +1 -1
  235. package/dist/cjs/src/pro/bitmex.js +1 -1
  236. package/dist/cjs/src/pro/bitrue.js +1 -1
  237. package/dist/cjs/src/pro/bitstamp.js +1 -1
  238. package/dist/cjs/src/pro/bitvavo.js +1 -1
  239. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  240. package/dist/cjs/src/pro/blofin.js +1 -1
  241. package/dist/cjs/src/pro/bullish.js +1 -1
  242. package/dist/cjs/src/pro/bybit.js +1 -1
  243. package/dist/cjs/src/pro/bydfi.js +1 -1
  244. package/dist/cjs/src/pro/cex.js +1 -1
  245. package/dist/cjs/src/pro/coinbase.js +1 -1
  246. package/dist/cjs/src/pro/coinbaseadvanced.js +1 -1
  247. package/dist/cjs/src/pro/coinbaseexchange.js +1 -1
  248. package/dist/cjs/src/pro/coinbaseinternational.js +1 -1
  249. package/dist/cjs/src/pro/coincheck.js +1 -1
  250. package/dist/cjs/src/pro/coinex.js +1 -1
  251. package/dist/cjs/src/pro/coinone.js +1 -1
  252. package/dist/cjs/src/pro/cryptocom.js +1 -1
  253. package/dist/cjs/src/pro/deepcoin.js +1 -1
  254. package/dist/cjs/src/pro/deribit.js +1 -1
  255. package/dist/cjs/src/pro/dydx.js +1 -1
  256. package/dist/cjs/src/pro/exmo.js +1 -1
  257. package/dist/cjs/src/pro/gate.js +78 -7
  258. package/dist/cjs/src/pro/gateio.js +1 -1
  259. package/dist/cjs/src/pro/gemini.js +1 -1
  260. package/dist/cjs/src/pro/grvt.js +5 -6
  261. package/dist/cjs/src/pro/hashkey.js +1 -1
  262. package/dist/cjs/src/pro/hitbtc.js +1 -1
  263. package/dist/cjs/src/pro/hollaex.js +1 -1
  264. package/dist/cjs/src/pro/htx.js +1 -1
  265. package/dist/cjs/src/pro/huobi.js +1 -1
  266. package/dist/cjs/src/pro/hyperliquid.js +362 -2
  267. package/dist/cjs/src/pro/independentreserve.js +1 -1
  268. package/dist/cjs/src/pro/kraken.js +1 -1
  269. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  270. package/dist/cjs/src/pro/kucoin.js +1191 -104
  271. package/dist/cjs/src/pro/kucoinfutures.js +1 -2
  272. package/dist/cjs/src/pro/lbank.js +0 -1
  273. package/dist/cjs/src/pro/lighter.js +2 -1
  274. package/dist/cjs/src/pro/luno.js +1 -1
  275. package/dist/cjs/src/pro/mexc.js +1 -1
  276. package/dist/cjs/src/pro/myokx.js +1 -1
  277. package/dist/cjs/src/pro/ndax.js +1 -1
  278. package/dist/cjs/src/pro/okx.js +1 -1
  279. package/dist/cjs/src/pro/okxus.js +1 -1
  280. package/dist/cjs/src/pro/onetrading.js +1 -1
  281. package/dist/cjs/src/pro/oxfun.js +1 -1
  282. package/dist/cjs/src/pro/p2b.js +1 -1
  283. package/dist/cjs/src/pro/pacifica.js +1 -1
  284. package/dist/cjs/src/pro/paradex.js +1 -1
  285. package/dist/cjs/src/pro/phemex.js +1 -1
  286. package/dist/cjs/src/pro/poloniex.js +1 -1
  287. package/dist/cjs/src/pro/toobit.js +1 -1
  288. package/dist/cjs/src/pro/upbit.js +1 -1
  289. package/dist/cjs/src/pro/weex.js +1 -1
  290. package/dist/cjs/src/pro/whitebit.js +1 -1
  291. package/dist/cjs/src/pro/xt.js +1 -1
  292. package/dist/cjs/src/protobuf/mexc/compiled.cjs.js +1 -0
  293. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.js +0 -1
  294. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.js +0 -1
  295. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.js +0 -1
  296. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.js +0 -1
  297. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.js +0 -1
  298. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.js +0 -1
  299. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.js +0 -1
  300. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.js +0 -1
  301. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.js +0 -1
  302. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.js +0 -1
  303. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.js +0 -1
  304. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.js +0 -1
  305. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.js +0 -1
  306. package/dist/cjs/src/static_dependencies/dydx-v4-client/google/protobuf/any.js +0 -1
  307. package/dist/cjs/src/static_dependencies/dydx-v4-client/helpers.js +0 -6
  308. package/dist/cjs/src/static_dependencies/dydx-v4-client/onboarding.js +0 -1
  309. package/dist/cjs/src/static_dependencies/dydx-v4-client/registry.js +0 -1
  310. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +0 -6
  311. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -1
  312. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +0 -6
  313. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +0 -1
  314. package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +0 -1
  315. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +0 -1
  316. package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +0 -1
  317. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +0 -1
  318. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +0 -1
  319. package/dist/cjs/src/static_dependencies/ethers/coders/null.js +0 -1
  320. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +0 -1
  321. package/dist/cjs/src/static_dependencies/ethers/coders/string.js +0 -1
  322. package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +0 -1
  323. package/dist/cjs/src/static_dependencies/ethers/fragments.js +0 -6
  324. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +0 -6
  325. package/dist/cjs/src/static_dependencies/ethers/index.js +10 -1
  326. package/dist/cjs/src/static_dependencies/ethers/interface.js +0 -6
  327. package/dist/cjs/src/static_dependencies/ethers/typed.js +0 -6
  328. package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +13 -1
  329. package/dist/cjs/src/static_dependencies/ethers/utils/data.js +6 -1
  330. package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +9 -1
  331. package/dist/cjs/src/static_dependencies/ethers/utils/events.js +0 -6
  332. package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +0 -6
  333. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +7 -1
  334. package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +5 -1
  335. package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +0 -6
  336. package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +8 -1
  337. package/dist/cjs/src/static_dependencies/fflake/browser.js +1 -1
  338. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -1
  339. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -1
  340. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +1 -1
  341. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -6
  342. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -6
  343. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -6
  344. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -1
  345. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +1 -1
  346. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -6
  347. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +1 -1
  348. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +1 -1
  349. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -6
  350. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +1 -1
  351. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -6
  352. package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +0 -6
  353. package/dist/cjs/src/static_dependencies/noble-curves/_shortw_utils.js +1 -1
  354. package/dist/cjs/src/static_dependencies/noble-curves/abstract/curve.js +1 -1
  355. package/dist/cjs/src/static_dependencies/noble-curves/abstract/edwards.js +1 -1
  356. package/dist/cjs/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -1
  357. package/dist/cjs/src/static_dependencies/noble-curves/abstract/modular.js +1 -1
  358. package/dist/cjs/src/static_dependencies/noble-curves/abstract/montgomery.js +1 -1
  359. package/dist/cjs/src/static_dependencies/noble-curves/abstract/poseidon.js +1 -1
  360. package/dist/cjs/src/static_dependencies/noble-curves/abstract/utils.js +0 -6
  361. package/dist/cjs/src/static_dependencies/noble-curves/abstract/weierstrass.js +1 -1
  362. package/dist/cjs/src/static_dependencies/noble-curves/ed25519.js +1 -1
  363. package/dist/cjs/src/static_dependencies/noble-curves/p256.js +1 -1
  364. package/dist/cjs/src/static_dependencies/noble-curves/secp256k1.js +1 -1
  365. package/dist/cjs/src/static_dependencies/noble-hashes/_assert.js +0 -6
  366. package/dist/cjs/src/static_dependencies/noble-hashes/_sha2.js +0 -1
  367. package/dist/cjs/src/static_dependencies/noble-hashes/_u64.js +0 -6
  368. package/dist/cjs/src/static_dependencies/noble-hashes/crypto.js +0 -6
  369. package/dist/cjs/src/static_dependencies/noble-hashes/hmac.js +0 -1
  370. package/dist/cjs/src/static_dependencies/noble-hashes/md5.js +0 -1
  371. package/dist/cjs/src/static_dependencies/noble-hashes/pbkdf2.js +0 -1
  372. package/dist/cjs/src/static_dependencies/noble-hashes/ripemd160.js +0 -1
  373. package/dist/cjs/src/static_dependencies/noble-hashes/sha1.js +0 -1
  374. package/dist/cjs/src/static_dependencies/noble-hashes/sha256.js +0 -1
  375. package/dist/cjs/src/static_dependencies/noble-hashes/sha3.js +0 -1
  376. package/dist/cjs/src/static_dependencies/noble-hashes/sha512.js +0 -1
  377. package/dist/cjs/src/static_dependencies/noble-hashes/utils.js +1 -1
  378. package/dist/cjs/src/static_dependencies/node-fetch/body.js +5 -1
  379. package/dist/cjs/src/static_dependencies/node-fetch/errors/abort-error.js +0 -1
  380. package/dist/cjs/src/static_dependencies/node-fetch/errors/base.js +0 -6
  381. package/dist/cjs/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -1
  382. package/dist/cjs/src/static_dependencies/node-fetch/headers.js +5 -1
  383. package/dist/cjs/src/static_dependencies/node-fetch/index.js +7 -1
  384. package/dist/cjs/src/static_dependencies/node-fetch/request.js +7 -1
  385. package/dist/cjs/src/static_dependencies/node-fetch/response.js +5 -1
  386. package/dist/cjs/src/static_dependencies/node-fetch/utils/get-search.js +0 -6
  387. package/dist/cjs/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -6
  388. package/dist/cjs/src/static_dependencies/node-fetch/utils/is.js +0 -6
  389. package/dist/cjs/src/static_dependencies/node-fetch/utils/referrer.js +0 -1
  390. package/dist/cjs/src/static_dependencies/proxies/agent-base/index.js +0 -1
  391. package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -1
  392. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -1
  393. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -6
  394. package/dist/cjs/src/static_dependencies/qs/formats.js +0 -6
  395. package/dist/cjs/src/static_dependencies/qs/index.js +0 -1
  396. package/dist/cjs/src/static_dependencies/qs/parse.js +0 -1
  397. package/dist/cjs/src/static_dependencies/qs/stringify.js +0 -1
  398. package/dist/cjs/src/static_dependencies/qs/utils.js +0 -6
  399. package/dist/cjs/src/static_dependencies/scure-base/index.js +0 -6
  400. package/dist/cjs/src/static_dependencies/scure-bip32/index.js +19 -1
  401. package/dist/cjs/src/static_dependencies/scure-bip39/index.js +1 -1
  402. package/dist/cjs/src/static_dependencies/scure-bip39/wordlists/english.js +0 -6
  403. package/dist/cjs/src/static_dependencies/scure-starknet/index.js +1 -1
  404. package/dist/cjs/src/static_dependencies/starknet/constants.js +1 -1
  405. package/dist/cjs/src/static_dependencies/starknet/types/calldata.js +0 -6
  406. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/abi.js +0 -6
  407. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/index.js +0 -6
  408. package/dist/cjs/src/static_dependencies/starknet/types/lib/index.js +0 -6
  409. package/dist/cjs/src/static_dependencies/starknet/types/typedData.js +0 -6
  410. package/dist/cjs/src/static_dependencies/starknet/utils/assert.js +0 -6
  411. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +1 -1
  412. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +1 -1
  413. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +1 -1
  414. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/byteArray.js +0 -1
  415. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/cairo.js +0 -1
  416. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +0 -6
  417. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +0 -6
  418. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +0 -6
  419. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/formatter.js +0 -1
  420. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/index.js +1 -1
  421. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/index.js +0 -1
  422. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +0 -1
  423. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +0 -6
  424. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +0 -1
  425. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/requestParser.js +0 -1
  426. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/responseParser.js +0 -1
  427. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/tuple.js +1 -1
  428. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/validate.js +4 -1
  429. package/dist/cjs/src/static_dependencies/starknet/utils/encode.js +0 -1
  430. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +3 -1
  431. package/dist/cjs/src/static_dependencies/starknet/utils/merkle.js +0 -1
  432. package/dist/cjs/src/static_dependencies/starknet/utils/num.js +0 -1
  433. package/dist/cjs/src/static_dependencies/starknet/utils/selector.js +0 -1
  434. package/dist/cjs/src/static_dependencies/starknet/utils/shortString.js +0 -1
  435. package/dist/cjs/src/static_dependencies/starknet/utils/typedData.js +1 -1
  436. package/dist/cjs/src/static_dependencies/watchable/src/unpromise.js +0 -6
  437. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +0 -6
  438. package/dist/cjs/src/tokocrypto.js +1 -1
  439. package/dist/cjs/src/toobit.js +1 -1
  440. package/dist/cjs/src/upbit.js +1 -1
  441. package/dist/cjs/src/wavesexchange.js +1 -1
  442. package/dist/cjs/src/weex.js +2 -2
  443. package/dist/cjs/src/whitebit.js +3 -1
  444. package/dist/cjs/src/woo.js +1 -1
  445. package/dist/cjs/src/woofipro.js +1 -1
  446. package/dist/cjs/src/xt.js +1 -1
  447. package/dist/cjs/src/yobit.js +1 -1
  448. package/dist/cjs/src/zaif.js +1 -1
  449. package/dist/cjs/src/zebpay.js +1 -1
  450. package/dist/cjs/src/zonda.js +1 -1
  451. package/js/ccxt.d.ts +1 -1
  452. package/js/ccxt.js +1 -7
  453. package/js/src/abstract/aftermath.js +0 -6
  454. package/js/src/abstract/alpaca.js +0 -6
  455. package/js/src/abstract/apex.js +0 -6
  456. package/js/src/abstract/arkham.js +0 -6
  457. package/js/src/abstract/ascendex.js +0 -6
  458. package/js/src/abstract/aster.js +0 -6
  459. package/js/src/abstract/backpack.js +0 -6
  460. package/js/src/abstract/bequant.js +0 -6
  461. package/js/src/abstract/bigone.js +0 -6
  462. package/js/src/abstract/binance.js +0 -6
  463. package/js/src/abstract/binancecoinm.js +0 -6
  464. package/js/src/abstract/binanceus.js +0 -6
  465. package/js/src/abstract/binanceusdm.js +0 -6
  466. package/js/src/abstract/bingx.js +0 -6
  467. package/js/src/abstract/bit2c.js +0 -6
  468. package/js/src/abstract/bitbank.js +0 -6
  469. package/js/src/abstract/bitbns.js +0 -6
  470. package/js/src/abstract/bitfinex.js +0 -6
  471. package/js/src/abstract/bitflyer.js +0 -6
  472. package/js/src/abstract/bitget.js +0 -6
  473. package/js/src/abstract/bithumb.js +0 -6
  474. package/js/src/abstract/bitmart.js +0 -6
  475. package/js/src/abstract/bitmex.js +0 -6
  476. package/js/src/abstract/bitopro.js +0 -6
  477. package/js/src/abstract/bitrue.js +0 -6
  478. package/js/src/abstract/bitso.js +0 -6
  479. package/js/src/abstract/bitstamp.js +0 -6
  480. package/js/src/abstract/bitteam.js +0 -6
  481. package/js/src/abstract/bittrade.js +0 -6
  482. package/js/src/abstract/bitvavo.js +0 -6
  483. package/js/src/abstract/blockchaincom.js +0 -6
  484. package/js/src/abstract/blofin.js +0 -6
  485. package/js/src/abstract/btcbox.js +0 -6
  486. package/js/src/abstract/btcmarkets.js +0 -6
  487. package/js/src/abstract/btcturk.js +0 -6
  488. package/js/src/abstract/bullish.js +0 -6
  489. package/js/src/abstract/bybit.js +0 -6
  490. package/js/src/abstract/bydfi.js +0 -6
  491. package/js/src/abstract/cex.js +0 -6
  492. package/js/src/abstract/coinbase.js +0 -6
  493. package/js/src/abstract/coinbaseadvanced.js +0 -6
  494. package/js/src/abstract/coinbaseexchange.js +0 -6
  495. package/js/src/abstract/coinbaseinternational.js +0 -6
  496. package/js/src/abstract/coincheck.js +0 -6
  497. package/js/src/abstract/coinex.js +0 -6
  498. package/js/src/abstract/coinmate.js +0 -6
  499. package/js/src/abstract/coinmetro.js +0 -6
  500. package/js/src/abstract/coinone.js +0 -6
  501. package/js/src/abstract/coinsph.js +0 -6
  502. package/js/src/abstract/coinspot.js +0 -6
  503. package/js/src/abstract/cryptocom.js +0 -6
  504. package/js/src/abstract/cryptomus.js +0 -6
  505. package/js/src/abstract/deepcoin.js +0 -6
  506. package/js/src/abstract/delta.js +0 -6
  507. package/js/src/abstract/deribit.js +0 -6
  508. package/js/src/abstract/derive.js +0 -6
  509. package/js/src/abstract/digifinex.js +0 -6
  510. package/js/src/abstract/dydx.js +0 -6
  511. package/js/src/abstract/exmo.js +0 -6
  512. package/js/src/abstract/fmfwio.js +0 -6
  513. package/js/src/abstract/foxbit.js +0 -6
  514. package/js/src/abstract/gate.js +0 -6
  515. package/js/src/abstract/gateio.js +0 -6
  516. package/js/src/abstract/gemini.js +0 -6
  517. package/js/src/abstract/grvt.js +0 -6
  518. package/js/src/abstract/hashkey.js +0 -6
  519. package/js/src/abstract/hibachi.js +0 -6
  520. package/js/src/abstract/hitbtc.js +0 -6
  521. package/js/src/abstract/hollaex.js +0 -6
  522. package/js/src/abstract/htx.js +0 -6
  523. package/js/src/abstract/huobi.js +0 -6
  524. package/js/src/abstract/hyperliquid.js +0 -6
  525. package/js/src/abstract/independentreserve.js +0 -6
  526. package/js/src/abstract/indodax.js +0 -6
  527. package/js/src/abstract/kraken.js +0 -6
  528. package/js/src/abstract/krakenfutures.js +0 -6
  529. package/js/src/abstract/kucoin.d.ts +5 -0
  530. package/js/src/abstract/kucoin.js +0 -6
  531. package/js/src/abstract/kucoinfutures.d.ts +5 -0
  532. package/js/src/abstract/kucoinfutures.js +0 -6
  533. package/js/src/abstract/latoken.js +0 -6
  534. package/js/src/abstract/lbank.js +0 -6
  535. package/js/src/abstract/lighter.js +0 -6
  536. package/js/src/abstract/luno.js +0 -6
  537. package/js/src/abstract/mercado.js +0 -6
  538. package/js/src/abstract/mexc.js +0 -6
  539. package/js/src/abstract/modetrade.js +0 -6
  540. package/js/src/abstract/myokx.d.ts +34 -0
  541. package/js/src/abstract/myokx.js +0 -6
  542. package/js/src/abstract/ndax.js +0 -6
  543. package/js/src/abstract/novadax.js +0 -6
  544. package/js/src/abstract/okx.d.ts +34 -0
  545. package/js/src/abstract/okx.js +0 -6
  546. package/js/src/abstract/okxus.d.ts +34 -0
  547. package/js/src/abstract/okxus.js +0 -6
  548. package/js/src/abstract/onetrading.js +0 -6
  549. package/js/src/abstract/oxfun.js +0 -6
  550. package/js/src/abstract/p2b.js +0 -6
  551. package/js/src/abstract/pacifica.js +0 -6
  552. package/js/src/abstract/paradex.js +0 -6
  553. package/js/src/abstract/paymium.js +0 -6
  554. package/js/src/abstract/phemex.js +0 -6
  555. package/js/src/abstract/poloniex.js +0 -6
  556. package/js/src/abstract/tokocrypto.js +0 -6
  557. package/js/src/abstract/toobit.js +0 -6
  558. package/js/src/abstract/upbit.js +0 -6
  559. package/js/src/abstract/wavesexchange.js +0 -6
  560. package/js/src/abstract/weex.js +0 -6
  561. package/js/src/abstract/whitebit.js +0 -6
  562. package/js/src/abstract/woo.js +0 -6
  563. package/js/src/abstract/woofipro.js +0 -6
  564. package/js/src/abstract/xt.js +0 -6
  565. package/js/src/abstract/yobit.js +0 -6
  566. package/js/src/abstract/zaif.js +0 -6
  567. package/js/src/abstract/zebpay.js +0 -6
  568. package/js/src/abstract/zonda.js +0 -6
  569. package/js/src/aftermath.js +0 -6
  570. package/js/src/alpaca.js +0 -6
  571. package/js/src/apex.js +0 -6
  572. package/js/src/arkham.js +0 -6
  573. package/js/src/ascendex.js +0 -6
  574. package/js/src/aster.js +0 -6
  575. package/js/src/backpack.js +0 -6
  576. package/js/src/base/Exchange.d.ts +6 -1
  577. package/js/src/base/Exchange.js +51 -19
  578. package/js/src/base/Precise.js +0 -6
  579. package/js/src/base/errorHierarchy.js +0 -6
  580. package/js/src/base/errors.js +0 -6
  581. package/js/src/base/functions/crypto.js +0 -6
  582. package/js/src/base/functions/encode.js +0 -6
  583. package/js/src/base/functions/generic.js +0 -6
  584. package/js/src/base/functions/io.js +0 -6
  585. package/js/src/base/functions/misc.js +0 -6
  586. package/js/src/base/functions/number.js +0 -6
  587. package/js/src/base/functions/platform.js +0 -6
  588. package/js/src/base/functions/rsa.js +0 -6
  589. package/js/src/base/functions/string.js +0 -6
  590. package/js/src/base/functions/throttle.js +0 -6
  591. package/js/src/base/functions/time.js +0 -6
  592. package/js/src/base/functions/totp.js +0 -6
  593. package/js/src/base/functions/type.js +0 -6
  594. package/js/src/base/functions.js +0 -6
  595. package/js/src/base/types.js +0 -6
  596. package/js/src/base/ws/Cache.js +0 -6
  597. package/js/src/base/ws/Client.js +0 -6
  598. package/js/src/base/ws/Future.js +0 -6
  599. package/js/src/base/ws/OrderBook.js +0 -6
  600. package/js/src/base/ws/OrderBookSide.js +0 -6
  601. package/js/src/base/ws/WsClient.js +0 -6
  602. package/js/src/base/ws/functions.js +0 -6
  603. package/js/src/bequant.js +0 -6
  604. package/js/src/bigone.js +0 -6
  605. package/js/src/binance.d.ts +1 -1
  606. package/js/src/binance.js +22 -16
  607. package/js/src/binancecoinm.js +0 -6
  608. package/js/src/binanceus.js +0 -6
  609. package/js/src/binanceusdm.js +0 -6
  610. package/js/src/bingx.js +0 -6
  611. package/js/src/bit2c.js +0 -6
  612. package/js/src/bitbank.js +0 -6
  613. package/js/src/bitbns.js +0 -6
  614. package/js/src/bitfinex.js +0 -6
  615. package/js/src/bitflyer.js +0 -6
  616. package/js/src/bitget.js +6 -9
  617. package/js/src/bithumb.js +0 -6
  618. package/js/src/bitmart.js +0 -6
  619. package/js/src/bitmex.js +0 -6
  620. package/js/src/bitopro.js +0 -6
  621. package/js/src/bitrue.js +0 -6
  622. package/js/src/bitso.js +0 -6
  623. package/js/src/bitstamp.js +0 -6
  624. package/js/src/bitteam.js +0 -6
  625. package/js/src/bittrade.js +0 -6
  626. package/js/src/bitvavo.js +0 -6
  627. package/js/src/blockchaincom.js +0 -6
  628. package/js/src/blofin.js +25 -36
  629. package/js/src/btcbox.js +0 -6
  630. package/js/src/btcmarkets.js +0 -6
  631. package/js/src/btcturk.js +0 -6
  632. package/js/src/bullish.js +0 -6
  633. package/js/src/bybit.js +0 -6
  634. package/js/src/bydfi.js +1 -7
  635. package/js/src/cex.js +0 -6
  636. package/js/src/coinbase.js +0 -6
  637. package/js/src/coinbaseadvanced.js +0 -6
  638. package/js/src/coinbaseexchange.js +0 -6
  639. package/js/src/coinbaseinternational.js +0 -6
  640. package/js/src/coincheck.js +0 -6
  641. package/js/src/coinex.js +0 -6
  642. package/js/src/coinmate.js +0 -6
  643. package/js/src/coinmetro.js +0 -6
  644. package/js/src/coinone.js +0 -6
  645. package/js/src/coinsph.js +0 -6
  646. package/js/src/coinspot.js +0 -6
  647. package/js/src/cryptocom.js +0 -6
  648. package/js/src/cryptomus.js +0 -6
  649. package/js/src/deepcoin.js +1 -7
  650. package/js/src/delta.js +0 -6
  651. package/js/src/deribit.js +0 -6
  652. package/js/src/derive.js +0 -6
  653. package/js/src/digifinex.js +0 -6
  654. package/js/src/dydx.js +0 -6
  655. package/js/src/exmo.js +0 -6
  656. package/js/src/fmfwio.js +0 -6
  657. package/js/src/foxbit.js +0 -6
  658. package/js/src/gate.js +0 -7
  659. package/js/src/gateio.js +0 -6
  660. package/js/src/gemini.js +0 -6
  661. package/js/src/grvt.js +14 -20
  662. package/js/src/hashkey.js +0 -6
  663. package/js/src/hibachi.js +1 -7
  664. package/js/src/hitbtc.js +0 -6
  665. package/js/src/hollaex.js +0 -6
  666. package/js/src/htx.js +0 -6
  667. package/js/src/huobi.js +0 -6
  668. package/js/src/hyperliquid.js +0 -6
  669. package/js/src/independentreserve.js +0 -6
  670. package/js/src/indodax.js +0 -6
  671. package/js/src/kraken.js +0 -6
  672. package/js/src/krakenfutures.js +0 -6
  673. package/js/src/kucoin.d.ts +27 -11
  674. package/js/src/kucoin.js +245 -116
  675. package/js/src/kucoinfutures.js +0 -7
  676. package/js/src/latoken.js +0 -6
  677. package/js/src/lbank.js +0 -6
  678. package/js/src/lighter.d.ts +11 -2
  679. package/js/src/lighter.js +313 -148
  680. package/js/src/luno.js +0 -6
  681. package/js/src/mercado.js +0 -6
  682. package/js/src/mexc.js +0 -6
  683. package/js/src/modetrade.js +0 -6
  684. package/js/src/myokx.js +0 -6
  685. package/js/src/ndax.js +0 -6
  686. package/js/src/novadax.js +0 -6
  687. package/js/src/okx.js +46 -7
  688. package/js/src/okxus.js +0 -6
  689. package/js/src/onetrading.js +0 -6
  690. package/js/src/oxfun.js +0 -6
  691. package/js/src/p2b.js +0 -6
  692. package/js/src/pacifica.js +0 -6
  693. package/js/src/paradex.js +0 -6
  694. package/js/src/paymium.js +0 -6
  695. package/js/src/phemex.js +0 -6
  696. package/js/src/poloniex.js +0 -6
  697. package/js/src/pro/aftermath.js +0 -6
  698. package/js/src/pro/alpaca.js +0 -6
  699. package/js/src/pro/apex.js +0 -6
  700. package/js/src/pro/arkham.js +0 -6
  701. package/js/src/pro/ascendex.js +0 -6
  702. package/js/src/pro/aster.d.ts +1 -1
  703. package/js/src/pro/aster.js +23 -48
  704. package/js/src/pro/backpack.js +0 -6
  705. package/js/src/pro/bequant.js +0 -6
  706. package/js/src/pro/binance.js +1 -7
  707. package/js/src/pro/binancecoinm.js +0 -6
  708. package/js/src/pro/binanceus.js +0 -6
  709. package/js/src/pro/binanceusdm.js +0 -6
  710. package/js/src/pro/bingx.js +0 -6
  711. package/js/src/pro/bitfinex.js +0 -6
  712. package/js/src/pro/bitget.js +0 -6
  713. package/js/src/pro/bithumb.js +0 -6
  714. package/js/src/pro/bitmart.js +0 -6
  715. package/js/src/pro/bitmex.js +0 -6
  716. package/js/src/pro/bitopro.js +0 -6
  717. package/js/src/pro/bitrue.js +0 -6
  718. package/js/src/pro/bitstamp.js +0 -6
  719. package/js/src/pro/bittrade.js +0 -6
  720. package/js/src/pro/bitvavo.js +0 -6
  721. package/js/src/pro/blockchaincom.js +0 -6
  722. package/js/src/pro/blofin.js +0 -6
  723. package/js/src/pro/bullish.js +0 -6
  724. package/js/src/pro/bybit.js +0 -6
  725. package/js/src/pro/bydfi.js +0 -6
  726. package/js/src/pro/cex.js +0 -6
  727. package/js/src/pro/coinbase.js +0 -6
  728. package/js/src/pro/coinbaseadvanced.js +0 -6
  729. package/js/src/pro/coinbaseexchange.js +0 -6
  730. package/js/src/pro/coinbaseinternational.js +0 -6
  731. package/js/src/pro/coincheck.js +0 -6
  732. package/js/src/pro/coinex.js +0 -6
  733. package/js/src/pro/coinone.js +0 -6
  734. package/js/src/pro/cryptocom.js +0 -6
  735. package/js/src/pro/deepcoin.js +0 -6
  736. package/js/src/pro/deribit.js +0 -6
  737. package/js/src/pro/derive.js +0 -6
  738. package/js/src/pro/dydx.js +0 -6
  739. package/js/src/pro/exmo.js +0 -6
  740. package/js/src/pro/gate.d.ts +1 -0
  741. package/js/src/pro/gate.js +77 -12
  742. package/js/src/pro/gateio.js +0 -6
  743. package/js/src/pro/gemini.js +0 -6
  744. package/js/src/pro/grvt.js +4 -11
  745. package/js/src/pro/hashkey.js +0 -6
  746. package/js/src/pro/hitbtc.js +0 -6
  747. package/js/src/pro/hollaex.js +0 -6
  748. package/js/src/pro/htx.js +0 -6
  749. package/js/src/pro/huobi.js +0 -6
  750. package/js/src/pro/hyperliquid.d.ts +48 -1
  751. package/js/src/pro/hyperliquid.js +362 -8
  752. package/js/src/pro/independentreserve.js +0 -6
  753. package/js/src/pro/kraken.js +0 -6
  754. package/js/src/pro/krakenfutures.js +0 -6
  755. package/js/src/pro/kucoin.d.ts +65 -6
  756. package/js/src/pro/kucoin.js +1190 -109
  757. package/js/src/pro/kucoinfutures.js +0 -7
  758. package/js/src/pro/lbank.js +0 -6
  759. package/js/src/pro/lighter.js +1 -6
  760. package/js/src/pro/luno.js +0 -6
  761. package/js/src/pro/mexc.js +0 -6
  762. package/js/src/pro/modetrade.js +0 -6
  763. package/js/src/pro/myokx.js +0 -6
  764. package/js/src/pro/ndax.js +0 -6
  765. package/js/src/pro/okx.js +0 -6
  766. package/js/src/pro/okxus.js +0 -6
  767. package/js/src/pro/onetrading.js +0 -6
  768. package/js/src/pro/oxfun.js +0 -6
  769. package/js/src/pro/p2b.js +0 -6
  770. package/js/src/pro/pacifica.js +0 -6
  771. package/js/src/pro/paradex.js +0 -6
  772. package/js/src/pro/phemex.js +0 -6
  773. package/js/src/pro/poloniex.js +0 -6
  774. package/js/src/pro/toobit.js +0 -6
  775. package/js/src/pro/upbit.js +0 -6
  776. package/js/src/pro/weex.js +0 -6
  777. package/js/src/pro/whitebit.js +0 -6
  778. package/js/src/pro/woo.js +0 -6
  779. package/js/src/pro/woofipro.js +0 -6
  780. package/js/src/pro/xt.js +0 -6
  781. package/js/src/protobuf/mexc/compiled.cjs +0 -6
  782. package/js/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.js +0 -6
  783. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/keys.js +0 -6
  784. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.js +0 -6
  785. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.js +0 -6
  786. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.js +0 -6
  787. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.js +0 -6
  788. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.js +0 -6
  789. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/block_rate_limit_config.js +0 -6
  790. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.js +0 -6
  791. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/equity_tier_limit_config.js +0 -6
  792. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/finalize_block.js +0 -6
  793. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations.js +0 -6
  794. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations_config.js +0 -6
  795. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/matches.js +0 -6
  796. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.js +0 -6
  797. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.js +0 -6
  798. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.js +0 -6
  799. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.js +0 -6
  800. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.js +0 -6
  801. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/asset_position.js +0 -6
  802. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/perpetual_position.js +0 -6
  803. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.js +0 -6
  804. package/js/src/static_dependencies/dydx-v4-client/google/protobuf/any.js +0 -6
  805. package/js/src/static_dependencies/dydx-v4-client/helpers.js +0 -6
  806. package/js/src/static_dependencies/dydx-v4-client/long/index.cjs +0 -6
  807. package/js/src/static_dependencies/dydx-v4-client/onboarding.js +0 -6
  808. package/js/src/static_dependencies/dydx-v4-client/registry.js +0 -6
  809. package/js/src/static_dependencies/ethers/abi-coder.js +0 -6
  810. package/js/src/static_dependencies/ethers/address/address.js +0 -6
  811. package/js/src/static_dependencies/ethers/address/checks.js +0 -6
  812. package/js/src/static_dependencies/ethers/address/contract-address.js +0 -6
  813. package/js/src/static_dependencies/ethers/address/index.js +0 -6
  814. package/js/src/static_dependencies/ethers/bytes32.js +0 -6
  815. package/js/src/static_dependencies/ethers/coders/abstract-coder.js +0 -6
  816. package/js/src/static_dependencies/ethers/coders/address.js +0 -6
  817. package/js/src/static_dependencies/ethers/coders/anonymous.js +0 -6
  818. package/js/src/static_dependencies/ethers/coders/array.js +0 -6
  819. package/js/src/static_dependencies/ethers/coders/boolean.js +0 -6
  820. package/js/src/static_dependencies/ethers/coders/bytes.js +0 -6
  821. package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +0 -6
  822. package/js/src/static_dependencies/ethers/coders/null.js +0 -6
  823. package/js/src/static_dependencies/ethers/coders/number.js +0 -6
  824. package/js/src/static_dependencies/ethers/coders/string.js +0 -6
  825. package/js/src/static_dependencies/ethers/coders/tuple.js +0 -6
  826. package/js/src/static_dependencies/ethers/fragments.js +0 -6
  827. package/js/src/static_dependencies/ethers/hash/index.js +0 -6
  828. package/js/src/static_dependencies/ethers/hash/solidity.js +0 -6
  829. package/js/src/static_dependencies/ethers/hash/typed-data.js +0 -6
  830. package/js/src/static_dependencies/ethers/index.js +0 -6
  831. package/js/src/static_dependencies/ethers/interface.js +0 -6
  832. package/js/src/static_dependencies/ethers/typed.js +0 -6
  833. package/js/src/static_dependencies/ethers/utils/base58.js +0 -6
  834. package/js/src/static_dependencies/ethers/utils/base64-browser.js +0 -6
  835. package/js/src/static_dependencies/ethers/utils/base64.js +0 -6
  836. package/js/src/static_dependencies/ethers/utils/data.js +0 -6
  837. package/js/src/static_dependencies/ethers/utils/errors.js +0 -6
  838. package/js/src/static_dependencies/ethers/utils/events.js +0 -6
  839. package/js/src/static_dependencies/ethers/utils/fixednumber.js +0 -6
  840. package/js/src/static_dependencies/ethers/utils/index.js +0 -6
  841. package/js/src/static_dependencies/ethers/utils/maths.js +0 -6
  842. package/js/src/static_dependencies/ethers/utils/properties.js +0 -6
  843. package/js/src/static_dependencies/ethers/utils/rlp-decode.js +0 -6
  844. package/js/src/static_dependencies/ethers/utils/rlp-encode.js +0 -6
  845. package/js/src/static_dependencies/ethers/utils/rlp.js +0 -6
  846. package/js/src/static_dependencies/ethers/utils/units.js +0 -6
  847. package/js/src/static_dependencies/ethers/utils/utf8.js +0 -6
  848. package/js/src/static_dependencies/ethers/utils/uuid.js +0 -6
  849. package/js/src/static_dependencies/fflake/browser.js +0 -6
  850. package/js/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -6
  851. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -6
  852. package/js/src/static_dependencies/jsencrypt/index.js +0 -6
  853. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +0 -6
  854. package/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -6
  855. package/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -6
  856. package/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -6
  857. package/js/src/static_dependencies/jsencrypt/lib/asn1js/oids.js +0 -6
  858. package/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -6
  859. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +0 -6
  860. package/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -6
  861. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +0 -6
  862. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +0 -6
  863. package/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -6
  864. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +0 -6
  865. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -6
  866. package/js/src/static_dependencies/messagepack/msgpack.js +0 -6
  867. package/js/src/static_dependencies/noble-curves/_shortw_utils.js +0 -6
  868. package/js/src/static_dependencies/noble-curves/abstract/curve.js +0 -6
  869. package/js/src/static_dependencies/noble-curves/abstract/edwards.js +0 -6
  870. package/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +0 -6
  871. package/js/src/static_dependencies/noble-curves/abstract/modular.js +0 -6
  872. package/js/src/static_dependencies/noble-curves/abstract/montgomery.js +0 -6
  873. package/js/src/static_dependencies/noble-curves/abstract/poseidon.js +0 -6
  874. package/js/src/static_dependencies/noble-curves/abstract/utils.js +0 -6
  875. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +0 -6
  876. package/js/src/static_dependencies/noble-curves/bn.js +0 -6
  877. package/js/src/static_dependencies/noble-curves/ed25519.js +0 -6
  878. package/js/src/static_dependencies/noble-curves/ed448.js +0 -6
  879. package/js/src/static_dependencies/noble-curves/index.js +0 -6
  880. package/js/src/static_dependencies/noble-curves/jubjub.js +0 -6
  881. package/js/src/static_dependencies/noble-curves/p256.js +0 -6
  882. package/js/src/static_dependencies/noble-curves/p384.js +0 -6
  883. package/js/src/static_dependencies/noble-curves/p521.js +0 -6
  884. package/js/src/static_dependencies/noble-curves/pasta.js +0 -6
  885. package/js/src/static_dependencies/noble-curves/secp256k1.js +0 -6
  886. package/js/src/static_dependencies/noble-hashes/_assert.js +0 -6
  887. package/js/src/static_dependencies/noble-hashes/_blake2.js +0 -6
  888. package/js/src/static_dependencies/noble-hashes/_sha2.js +0 -6
  889. package/js/src/static_dependencies/noble-hashes/_u64.js +0 -6
  890. package/js/src/static_dependencies/noble-hashes/argon2.js +0 -6
  891. package/js/src/static_dependencies/noble-hashes/blake2b.js +0 -6
  892. package/js/src/static_dependencies/noble-hashes/blake2s.js +0 -6
  893. package/js/src/static_dependencies/noble-hashes/blake3.js +0 -6
  894. package/js/src/static_dependencies/noble-hashes/crypto.js +0 -6
  895. package/js/src/static_dependencies/noble-hashes/cryptoNode.js +0 -6
  896. package/js/src/static_dependencies/noble-hashes/eskdf.js +0 -6
  897. package/js/src/static_dependencies/noble-hashes/hkdf.js +0 -6
  898. package/js/src/static_dependencies/noble-hashes/hmac.js +0 -6
  899. package/js/src/static_dependencies/noble-hashes/index.js +0 -6
  900. package/js/src/static_dependencies/noble-hashes/md5.js +0 -6
  901. package/js/src/static_dependencies/noble-hashes/pbkdf2.js +0 -6
  902. package/js/src/static_dependencies/noble-hashes/ripemd160.js +0 -6
  903. package/js/src/static_dependencies/noble-hashes/scrypt.js +0 -6
  904. package/js/src/static_dependencies/noble-hashes/sha1.js +0 -6
  905. package/js/src/static_dependencies/noble-hashes/sha256.js +0 -6
  906. package/js/src/static_dependencies/noble-hashes/sha3-addons.js +0 -6
  907. package/js/src/static_dependencies/noble-hashes/sha3.js +0 -6
  908. package/js/src/static_dependencies/noble-hashes/sha512.js +0 -6
  909. package/js/src/static_dependencies/noble-hashes/utils.js +0 -6
  910. package/js/src/static_dependencies/node-fetch/body.js +0 -6
  911. package/js/src/static_dependencies/node-fetch/errors/abort-error.js +0 -6
  912. package/js/src/static_dependencies/node-fetch/errors/base.js +0 -6
  913. package/js/src/static_dependencies/node-fetch/errors/fetch-error.js +0 -6
  914. package/js/src/static_dependencies/node-fetch/headers.js +0 -6
  915. package/js/src/static_dependencies/node-fetch/index.js +0 -6
  916. package/js/src/static_dependencies/node-fetch/request.js +0 -6
  917. package/js/src/static_dependencies/node-fetch/response.js +0 -6
  918. package/js/src/static_dependencies/node-fetch/utils/get-search.js +0 -6
  919. package/js/src/static_dependencies/node-fetch/utils/is-redirect.js +0 -6
  920. package/js/src/static_dependencies/node-fetch/utils/is.js +0 -6
  921. package/js/src/static_dependencies/node-fetch/utils/referrer.js +0 -6
  922. package/js/src/static_dependencies/proxies/agent-base/helpers.js +0 -6
  923. package/js/src/static_dependencies/proxies/agent-base/index.js +0 -6
  924. package/js/src/static_dependencies/proxies/http-proxy-agent/index.js +0 -6
  925. package/js/src/static_dependencies/proxies/https-proxy-agent/index.js +0 -6
  926. package/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +0 -6
  927. package/js/src/static_dependencies/qs/formats.js +0 -6
  928. package/js/src/static_dependencies/qs/index.js +0 -6
  929. package/js/src/static_dependencies/qs/parse.js +0 -6
  930. package/js/src/static_dependencies/qs/stringify.js +0 -6
  931. package/js/src/static_dependencies/qs/utils.js +0 -6
  932. package/js/src/static_dependencies/scure-base/index.js +0 -6
  933. package/js/src/static_dependencies/scure-bip32/index.js +0 -6
  934. package/js/src/static_dependencies/scure-bip39/index.js +0 -6
  935. package/js/src/static_dependencies/scure-bip39/wordlists/english.js +0 -6
  936. package/js/src/static_dependencies/scure-starknet/index.js +0 -6
  937. package/js/src/static_dependencies/starknet/constants.js +0 -6
  938. package/js/src/static_dependencies/starknet/index.js +0 -6
  939. package/js/src/static_dependencies/starknet/types/cairoEnum.js +0 -6
  940. package/js/src/static_dependencies/starknet/types/calldata.js +0 -6
  941. package/js/src/static_dependencies/starknet/types/index.js +0 -6
  942. package/js/src/static_dependencies/starknet/types/lib/contract/abi.js +0 -6
  943. package/js/src/static_dependencies/starknet/types/lib/contract/index.js +0 -6
  944. package/js/src/static_dependencies/starknet/types/lib/contract/legacy.js +0 -6
  945. package/js/src/static_dependencies/starknet/types/lib/contract/sierra.js +0 -6
  946. package/js/src/static_dependencies/starknet/types/lib/index.js +0 -6
  947. package/js/src/static_dependencies/starknet/types/typedData.js +0 -6
  948. package/js/src/static_dependencies/starknet/utils/address.js +0 -6
  949. package/js/src/static_dependencies/starknet/utils/assert.js +0 -6
  950. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +0 -6
  951. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +0 -6
  952. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +0 -6
  953. package/js/src/static_dependencies/starknet/utils/calldata/byteArray.js +0 -6
  954. package/js/src/static_dependencies/starknet/utils/calldata/cairo.js +0 -6
  955. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +0 -6
  956. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +0 -6
  957. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +0 -6
  958. package/js/src/static_dependencies/starknet/utils/calldata/enum/index.js +0 -6
  959. package/js/src/static_dependencies/starknet/utils/calldata/formatter.js +0 -6
  960. package/js/src/static_dependencies/starknet/utils/calldata/index.js +0 -6
  961. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.js +0 -6
  962. package/js/src/static_dependencies/starknet/utils/calldata/parser/interface.js +0 -6
  963. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +0 -6
  964. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +0 -6
  965. package/js/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +0 -6
  966. package/js/src/static_dependencies/starknet/utils/calldata/requestParser.js +0 -6
  967. package/js/src/static_dependencies/starknet/utils/calldata/responseParser.js +0 -6
  968. package/js/src/static_dependencies/starknet/utils/calldata/tuple.js +0 -6
  969. package/js/src/static_dependencies/starknet/utils/calldata/validate.js +0 -6
  970. package/js/src/static_dependencies/starknet/utils/encode.js +0 -6
  971. package/js/src/static_dependencies/starknet/utils/hash/classHash.js +0 -6
  972. package/js/src/static_dependencies/starknet/utils/hash/index.js +0 -6
  973. package/js/src/static_dependencies/starknet/utils/merkle.js +0 -6
  974. package/js/src/static_dependencies/starknet/utils/num.js +0 -6
  975. package/js/src/static_dependencies/starknet/utils/selector.js +0 -6
  976. package/js/src/static_dependencies/starknet/utils/shortString.js +0 -6
  977. package/js/src/static_dependencies/starknet/utils/starknetId.js +0 -6
  978. package/js/src/static_dependencies/starknet/utils/typedData.js +0 -6
  979. package/js/src/static_dependencies/starknet/utils/uint256.js +0 -6
  980. package/js/src/static_dependencies/starknet/utils/url.js +0 -6
  981. package/js/src/static_dependencies/watchable/src/index.js +0 -6
  982. package/js/src/static_dependencies/watchable/src/types.js +0 -6
  983. package/js/src/static_dependencies/watchable/src/unpromise.js +0 -6
  984. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +0 -6
  985. package/js/src/tokocrypto.js +0 -6
  986. package/js/src/toobit.js +0 -6
  987. package/js/src/upbit.js +0 -6
  988. package/js/src/wavesexchange.js +0 -6
  989. package/js/src/weex.js +1 -7
  990. package/js/src/whitebit.js +2 -6
  991. package/js/src/woo.js +0 -6
  992. package/js/src/woofipro.js +0 -6
  993. package/js/src/xt.js +0 -6
  994. package/js/src/yobit.js +0 -6
  995. package/js/src/zaif.js +0 -6
  996. package/js/src/zebpay.js +0 -6
  997. package/js/src/zonda.js +0 -6
  998. package/package.json +1 -1
package/js/src/lighter.js CHANGED
@@ -1,14 +1,11 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
1
  // ---------------------------------------------------------------------------
8
2
  import Exchange from './abstract/lighter.js';
9
- import { ArgumentsRequired, BadRequest, ExchangeError, InvalidOrder, RateLimitExceeded } from './base/errors.js';
3
+ import { ArgumentsRequired, BadRequest, ExchangeError, InvalidOrder, NotSupported, RateLimitExceeded } from './base/errors.js';
10
4
  import { TICK_SIZE } from './base/functions/number.js';
11
5
  import Precise from './base/Precise.js';
6
+ import { ecdsa } from './base/functions/crypto.js';
7
+ import { keccak_256 as keccak } from './static_dependencies/noble-hashes/sha3.js';
8
+ import { secp256k1 } from './static_dependencies/noble-curves/secp256k1.js';
12
9
  // ---------------------------------------------------------------------------
13
10
  /**
14
11
  * @class lighter
@@ -25,6 +22,7 @@ export default class lighter extends Exchange {
25
22
  'certified': false,
26
23
  'pro': true,
27
24
  'dex': true,
25
+ 'quoteJsonNumbers': false,
28
26
  'has': {
29
27
  'CORS': undefined,
30
28
  'spot': false,
@@ -247,6 +245,7 @@ export default class lighter extends Exchange {
247
245
  'httpExceptions': {},
248
246
  'exceptions': {
249
247
  'exact': {
248
+ '21146': ExchangeError,
250
249
  '21500': ExchangeError,
251
250
  '21501': ExchangeError,
252
251
  '21502': ExchangeError,
@@ -340,11 +339,16 @@ export default class lighter extends Exchange {
340
339
  'commonCurrencies': {},
341
340
  'options': {
342
341
  'defaultType': 'swap',
342
+ 'builderFee': true,
343
343
  'chainId': 304,
344
344
  'accountIndex': undefined,
345
345
  'apiKeyIndex': undefined,
346
+ 'lighterPrivateKey': undefined,
346
347
  'wasmExecPath': undefined,
347
348
  'libraryPath': undefined,
349
+ 'integratorAccountIndex': 718718,
350
+ 'integratorMakerFee': 1000,
351
+ 'integratorTakerFee': 1000,
348
352
  'authDeadlineExpiry': 28800,
349
353
  'authDeadlineMinimumRemaining': 60,
350
354
  },
@@ -370,16 +374,66 @@ export default class lighter extends Exchange {
370
374
  });
371
375
  }
372
376
  async loadAccount(chainId, privateKey, apiKeyIndex, accountIndex, params = {}) {
373
- let signer = this.safeDict(this.options, 'signer');
377
+ this.initAuthObject(accountIndex, apiKeyIndex);
378
+ const cachedAuths = this.safeDict(this.options['auths'][accountIndex], apiKeyIndex);
379
+ let signer = this.safeValue(cachedAuths, 'signer');
374
380
  if (signer !== undefined) {
375
381
  return signer;
376
382
  }
377
383
  let libraryPath = undefined;
378
384
  [libraryPath, params] = this.handleOptionAndParams(params, 'loadAccount', 'libraryPath');
379
- signer = await this.loadLighterLibrary(libraryPath, chainId, privateKey, apiKeyIndex, accountIndex);
380
- this.options['signer'] = signer;
385
+ const lighterPrivateKeyIsSet = (privateKey !== undefined) && (privateKey !== '');
386
+ if (lighterPrivateKeyIsSet && (libraryPath !== undefined) && (apiKeyIndex !== undefined) && (accountIndex !== undefined)) {
387
+ // load lighter library, and create lighter client
388
+ signer = await this.loadLighterLibrary(libraryPath, chainId, privateKey, this.parseToInt(apiKeyIndex), this.parseToInt(accountIndex), true);
389
+ this.options['auths'][accountIndex][apiKeyIndex]['signer'] = signer;
390
+ return signer;
391
+ }
392
+ const privateKeyIsSet = (this.privateKey !== undefined) && (this.privateKey !== '');
393
+ if (privateKeyIsSet && (apiKeyIndex !== undefined) && (accountIndex !== undefined)) {
394
+ if (this.privateKey.length > 66) {
395
+ throw new NotSupported(this.id + ' after the latest update (v4.5.50), CCXT now expects the l1 private key to be provided in the credentials. Please check for more details: https://github.com/ccxt/ccxt/wiki/FAQ#how-to-use-the-lighter-exchange-in-ccxt');
396
+ }
397
+ // load lighter library without creating lighter client
398
+ signer = await this.loadLighterLibrary(libraryPath, chainId, '', this.parseToInt(apiKeyIndex), this.parseToInt(accountIndex), false);
399
+ this.options['auths'][accountIndex][apiKeyIndex]['signer'] = signer;
400
+ const res = await this.changeApiKey();
401
+ await this.handleBuilderFeeApproval(this.parseToInt(accountIndex), this.parseToInt(apiKeyIndex));
402
+ return res;
403
+ }
381
404
  return signer;
382
405
  }
406
+ initAuthObject(strAccountIndex, strApiKeyIndex) {
407
+ if (!('auths' in this.options)) {
408
+ this.options['auths'] = {};
409
+ }
410
+ if (!(strAccountIndex in this.options['auths'])) {
411
+ this.options['auths'][strAccountIndex] = {};
412
+ }
413
+ if (!(strApiKeyIndex in this.options['auths'][strAccountIndex])) {
414
+ this.options['auths'][strAccountIndex][strApiKeyIndex] = {
415
+ 'signer': undefined,
416
+ 'lighterPrivateKey': undefined,
417
+ 'deadline': undefined,
418
+ 'token': undefined,
419
+ };
420
+ }
421
+ }
422
+ getLighterPrivateKey(strAccountIndex, strApiKeyIndex) {
423
+ if (!('auths' in this.options)) {
424
+ return undefined;
425
+ }
426
+ if (!(strAccountIndex in this.options['auths'])) {
427
+ return undefined;
428
+ }
429
+ if (!(strApiKeyIndex in this.options['auths'][strAccountIndex])) {
430
+ return undefined;
431
+ }
432
+ if (!('lighterPrivateKey' in this.options['auths'][strAccountIndex][strApiKeyIndex])) {
433
+ return undefined;
434
+ }
435
+ return this.options['auths'][strAccountIndex][strApiKeyIndex]['lighterPrivateKey'];
436
+ }
383
437
  /**
384
438
  * @method
385
439
  * @name lighter#preLoadLighterLibrary
@@ -388,31 +442,47 @@ export default class lighter extends Exchange {
388
442
  * @returns {boolean} true if the signer was loaded, false otherwise
389
443
  */
390
444
  async preLoadLighterLibrary(params = {}) {
391
- let signer = this.safeDict(this.options, 'signer');
445
+ let apiKeyIndex = undefined;
446
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'loadAccount', 'apiKeyIndex', 'api_key_index');
447
+ let accountIndex = undefined;
448
+ [accountIndex, params] = await this.handleAccountIndex(params, 'loadAccount', 'accountIndex', 'account_index');
449
+ if (accountIndex === undefined) {
450
+ throw new ArgumentsRequired(this.id + ' requires accountIndex or account_index');
451
+ }
452
+ const strAccountIndex = this.numberToString(accountIndex);
453
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
454
+ this.initAuthObject(strAccountIndex, strApiKeyIndex);
455
+ let signer = this.safeDict(this.options['auths'][strAccountIndex][strApiKeyIndex], 'signer');
392
456
  if (signer !== undefined) {
393
457
  return true;
394
458
  }
395
- let libraryPath = undefined;
396
- [libraryPath, params] = this.handleOptionAndParams(params, 'loadAccount', 'libraryPath');
459
+ signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex);
460
+ await this.handleBuilderFeeApproval(accountIndex, apiKeyIndex);
461
+ return (signer !== undefined);
462
+ }
463
+ handleApiKeyIndex(params, methodName1, optionName1, optionName2, defaultValue = undefined) {
397
464
  let apiKeyIndex = undefined;
398
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'loadAccount', 'apiKeyIndex', 'api_key_index');
399
- let accountIndex = undefined;
400
- [accountIndex, params] = this.handleOptionAndParams2(params, 'loadAccount', 'accountIndex', 'account_index');
401
- const privateKeyIsSet = (this.privateKey !== undefined) && (this.privateKey !== '');
402
- if (privateKeyIsSet && (libraryPath !== undefined) && (apiKeyIndex !== undefined) && (accountIndex !== undefined)) {
403
- signer = await this.loadLighterLibrary(libraryPath, this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex);
404
- this.options['signer'] = signer;
405
- return true;
465
+ [apiKeyIndex, params] = this.handleOptionAndParams2(params, methodName1, optionName1, optionName2, defaultValue);
466
+ if ((apiKeyIndex === undefined) || (apiKeyIndex < 4) || (apiKeyIndex > 254)) {
467
+ // apiKeyIndex = this.randNumber (2);
468
+ apiKeyIndex = 254;
469
+ this.options['apiKeyIndex'] = apiKeyIndex; // default to a value to avoid overriding other keys
406
470
  }
407
- return false;
471
+ return [this.parseToInt(apiKeyIndex), params];
408
472
  }
409
473
  async handleAccountIndex(params, methodName1, optionName1, optionName2, defaultValue = undefined) {
410
474
  let accountIndex = undefined;
411
475
  [accountIndex, params] = this.handleOptionAndParams2(params, methodName1, optionName1, optionName2, defaultValue);
412
476
  if (accountIndex === undefined) {
413
- const walletAddress = this.walletAddress;
477
+ let walletAddress = this.walletAddress;
478
+ if (this.privateKey !== undefined) {
479
+ if (this.privateKey.length > 66) {
480
+ throw new NotSupported(this.id + ' after the latest update (v4.5.50), CCXT now expects the l1 private key to be provided in the credentials. Please check for more details: https://github.com/ccxt/ccxt/wiki/FAQ#how-to-use-the-lighter-exchange-in-ccxt');
481
+ }
482
+ walletAddress = this.ethGetAddressFromPrivateKey(this.privateKey);
483
+ }
414
484
  if (walletAddress === undefined || walletAddress === '') {
415
- throw new ArgumentsRequired(this.id + ' ' + methodName1 + '() requires an ' + optionName1 + '/' + optionName2 + ' parameter or walletAddress to fetch accountIndex');
485
+ throw new ArgumentsRequired(this.id + ' ' + methodName1 + '() requires an ' + optionName1 + '/' + optionName2 + ' parameter or walletAddress to fetch accountIndex. Alternatively set privateKey in credentials to enable automatic walletAddress detection.');
416
486
  }
417
487
  const res = await this.publicGetAccountsByL1Address({ 'l1_address': walletAddress });
418
488
  //
@@ -452,19 +522,18 @@ export default class lighter extends Exchange {
452
522
  }
453
523
  async createSubAccount(name, params = {}) {
454
524
  let apiKeyIndex = undefined;
455
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'createSubAccount', 'apiKeyIndex', 'api_key_index');
456
- if (apiKeyIndex === undefined) {
457
- throw new ArgumentsRequired(this.id + ' createSubAccount() requires an apiKeyIndex parameter');
458
- }
525
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'createSubAccount', 'apiKeyIndex', 'api_key_index');
459
526
  let accountIndex = undefined;
460
527
  [accountIndex, params] = await this.handleAccountIndex(params, 'createSubAccount', 'accountIndex', 'account_index');
461
- const nonce = await this.fetchNonce(accountIndex, apiKeyIndex);
528
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
462
529
  const signRaw = {
463
530
  'nonce': nonce,
464
531
  'api_key_index': apiKeyIndex,
465
532
  'account_index': accountIndex,
466
533
  };
467
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
534
+ const strAccountIndex = this.numberToString(accountIndex);
535
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
536
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
468
537
  const [txType, txInfo] = this.lighterSignCreateSubAccount(signer, this.extend(signRaw, params));
469
538
  const request = {
470
539
  'tx_type': txType,
@@ -474,15 +543,15 @@ export default class lighter extends Exchange {
474
543
  }
475
544
  createAuth(params = {}) {
476
545
  // don't omit [accountIndex, apiKeyIndex], request may need them
477
- let apiKeyIndex = this.safeInteger2(params, 'apiKeyIndex', 'api_key_index');
546
+ let apiKeyIndex = this.safeString2(params, 'apiKeyIndex', 'api_key_index');
478
547
  if (apiKeyIndex === undefined) {
479
548
  const res = this.handleOptionAndParams2({}, 'createAuth', 'apiKeyIndex', 'api_key_index');
480
- apiKeyIndex = this.safeInteger(res, 0);
549
+ apiKeyIndex = this.safeString(res, 0);
481
550
  }
482
- let accountIndex = this.safeInteger2(params, 'accountIndex', 'account_index');
551
+ let accountIndex = this.safeString2(params, 'accountIndex', 'account_index');
483
552
  if (accountIndex === undefined) {
484
553
  const res = this.handleOptionAndParams2({}, 'createAuth', 'accountIndex', 'account_index');
485
- accountIndex = this.safeInteger(res, 0);
554
+ accountIndex = this.safeString(res, 0);
486
555
  }
487
556
  const auths = this.safeDict(this.options, 'auths');
488
557
  const accountAuths = this.safeDict(auths, accountIndex);
@@ -497,20 +566,12 @@ export default class lighter extends Exchange {
497
566
  const deadline = this.seconds() + this.safeInteger(this.options, 'authDeadlineExpiry');
498
567
  const request = {
499
568
  'deadline': deadline,
500
- 'api_key_index': apiKeyIndex,
501
- 'account_index': accountIndex,
502
- };
503
- const token = this.lighterCreateAuthToken(this.safeValue(this.options, 'signer'), request);
504
- if (!('auths' in this.options)) {
505
- this.options['auths'] = {};
506
- }
507
- if (!(accountIndex in this.options['auths'])) {
508
- this.options['auths'][accountIndex] = {};
509
- }
510
- this.options['auths'][accountIndex][apiKeyIndex] = {
511
- 'deadline': deadline,
512
- 'token': token,
569
+ 'api_key_index': this.parseToInt(apiKeyIndex),
570
+ 'account_index': this.parseToInt(accountIndex),
513
571
  };
572
+ const token = this.lighterCreateAuthToken(this.options['auths'][accountIndex][apiKeyIndex]['signer'], request);
573
+ this.options['auths'][accountIndex][apiKeyIndex]['deadline'] = deadline;
574
+ this.options['auths'][accountIndex][apiKeyIndex]['token'] = token;
514
575
  return token;
515
576
  }
516
577
  pow(n, m) {
@@ -530,6 +591,104 @@ export default class lighter extends Exchange {
530
591
  }
531
592
  return r;
532
593
  }
594
+ hashMessage(message) {
595
+ const binaryMessage = this.encode(message);
596
+ const binaryMessageLength = this.binaryLength(binaryMessage);
597
+ const x19 = this.base16ToBinary('19');
598
+ const newline = this.base16ToBinary('0a');
599
+ const prefix = this.binaryConcat(x19, this.encode('Ethereum Signed Message:'), newline, this.encode(this.numberToString(binaryMessageLength)));
600
+ return '0x' + this.hash(this.binaryConcat(prefix, binaryMessage), keccak, 'hex');
601
+ }
602
+ signHash(hash, privateKey) {
603
+ this.checkRequiredCredentials();
604
+ const signature = ecdsa(hash.slice(-64), privateKey.slice(-64), secp256k1, undefined);
605
+ const r = signature['r'];
606
+ const s = signature['s'];
607
+ const v = this.intToBase16(this.sum(27, signature['v']));
608
+ return '0x' + r.padStart(64, '0') + s.padStart(64, '0') + v;
609
+ }
610
+ signL1AndPrepareTxInfo(txInfo, message, privateKey) {
611
+ const hashMessage = this.hashMessage(message);
612
+ const signature = this.signHash(hashMessage, privateKey);
613
+ const decTxInfo = this.parseJson(txInfo);
614
+ decTxInfo['L1Sig'] = signature;
615
+ return this.json(decTxInfo);
616
+ }
617
+ async handleBuilderFeeApproval(accountIndex, apiKeyIndex) {
618
+ const buildFee = this.safeBool(this.options, 'builderFee', true);
619
+ if (!buildFee) {
620
+ return false;
621
+ }
622
+ const approvedBuilderFee = this.safeBool(this.options, 'approvedBuilderFee', false);
623
+ if (approvedBuilderFee) {
624
+ return true;
625
+ }
626
+ try {
627
+ const builder = this.safeInteger(this.options, 'integratorAccountIndex', 718718);
628
+ const takerFeeRate = this.safeInteger(this.options, 'integratorTakerFee', 1000);
629
+ const makerFeeRate = this.safeInteger(this.options, 'integratorMakerFee', 1000);
630
+ await this.approveBuilderFee(builder, takerFeeRate, makerFeeRate, accountIndex, apiKeyIndex);
631
+ this.options['approvedBuilderFee'] = true;
632
+ }
633
+ catch (e) {
634
+ this.options['builderFee'] = false;
635
+ }
636
+ return true;
637
+ }
638
+ async approveBuilderFee(builder, takerFeeRate, makerFeeRate, accountIndex, apiKeyIndex, params = {}) {
639
+ const strAccountIndex = this.numberToString(accountIndex);
640
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
641
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
642
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, this.extend(params, { 'skipNonce': false }));
643
+ const expiry = this.milliseconds() + 365 * 864000;
644
+ const signRaw = {
645
+ 'integrator_account_index': builder,
646
+ 'integrator_taker_fee': takerFeeRate,
647
+ 'integrator_maker_fee': makerFeeRate,
648
+ 'approval_expiry': expiry,
649
+ 'nonce': nonce,
650
+ 'api_key_index': apiKeyIndex,
651
+ 'account_index': accountIndex,
652
+ };
653
+ const [txType, txInfo, messageToSign] = this.lighterSignApproveIntegrator(signer, this.extend(signRaw, params));
654
+ const newTxInfo = this.signL1AndPrepareTxInfo(txInfo, messageToSign, this.privateKey);
655
+ const request = {
656
+ 'tx_type': txType,
657
+ 'tx_info': newTxInfo,
658
+ };
659
+ const response = await this.publicPostSendTx(request);
660
+ return response;
661
+ }
662
+ async changeApiKey(params = {}) {
663
+ let apiKeyIndex = undefined;
664
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'changeApiKey', 'apiKeyIndex', 'api_key_index');
665
+ let accountIndex = undefined;
666
+ [accountIndex, params] = await this.handleAccountIndex(params, 'changeApiKey', 'accountIndex', 'account_index');
667
+ const strAccountIndex = this.numberToString(accountIndex);
668
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
669
+ const signerNotLoad = this.options['auths'][strAccountIndex][strApiKeyIndex]['signer'];
670
+ const [privateKey, publicKey] = this.lighterGenerateApiKey(signerNotLoad);
671
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, this.extend(params, { 'skipNonce': false }));
672
+ const signRaw = {
673
+ 'pubkey': this.encode(publicKey),
674
+ 'nonce': nonce,
675
+ 'api_key_index': apiKeyIndex,
676
+ 'account_index': accountIndex,
677
+ };
678
+ // create lighter client
679
+ const signer = this.lighterCreateClient(signerNotLoad, this.options['chainId'], privateKey, apiKeyIndex, accountIndex);
680
+ const [txType, txInfo, messageToSign] = this.lighterSignChangePubkey(signer, this.extend(signRaw, params));
681
+ const newTxInfo = this.signL1AndPrepareTxInfo(txInfo, messageToSign, this.privateKey);
682
+ const request = {
683
+ 'tx_type': txType,
684
+ 'tx_info': newTxInfo,
685
+ };
686
+ await this.publicPostSendTx(request);
687
+ this.options['auths'][strAccountIndex][strApiKeyIndex]['lighterPrivateKey'] = privateKey;
688
+ this.options['auths'][strAccountIndex][strApiKeyIndex]['signer'] = signer; // reassign signer in go
689
+ await this.handleBuilderFeeApproval(accountIndex, apiKeyIndex);
690
+ return signer;
691
+ }
533
692
  setSandboxMode(enable) {
534
693
  super.setSandboxMode(enable);
535
694
  this.options['sandboxMode'] = enable;
@@ -567,14 +726,13 @@ export default class lighter extends Exchange {
567
726
  let apiKeyIndex = undefined;
568
727
  let accountIndex = undefined;
569
728
  let orderExpiry = undefined;
570
- [apiKeyIndex, params] = this.handleOptionAndParams(params, 'createOrder', 'apiKeyIndex', 255);
571
- if (apiKeyIndex === undefined) {
572
- throw new ArgumentsRequired(this.id + ' createOrder() requires an apiKeyIndex parameter');
573
- }
729
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'createOrder', 'apiKeyIndex', 'api_key_index');
574
730
  [accountIndex, params] = this.handleOptionAndParams2(params, 'createOrder', 'accountIndex', 'account_index');
575
731
  [nonce, params] = this.handleOptionAndParams(params, 'createOrder', 'nonce');
576
732
  [orderExpiry, params] = this.handleOptionAndParams(params, 'createOrder', 'orderExpiry', 0);
577
- request['nonce'] = nonce;
733
+ if (nonce !== undefined) {
734
+ request['nonce'] = nonce;
735
+ }
578
736
  request['api_key_index'] = apiKeyIndex;
579
737
  request['account_index'] = this.parseToInt(accountIndex);
580
738
  const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
@@ -660,6 +818,11 @@ export default class lighter extends Exchange {
660
818
  request['base_amount'] = this.parseToInt(Precise.stringMul(amountStr, amountScale));
661
819
  request['avg_execution_price'] = this.parseToInt(Precise.stringMul(priceStr, priceScale));
662
820
  request['trigger_price'] = this.parseToInt(Precise.stringMul(triggerPriceStr, priceScale));
821
+ if (this.safeBool(this.options, 'builderFee', true)) {
822
+ request['integrator_account_index'] = this.options['integratorAccountIndex'];
823
+ request['integrator_taker_fee'] = this.options['integratorTakerFee'];
824
+ request['integrator_maker_fee'] = this.options['integratorMakerFee'];
825
+ }
663
826
  const orders = [];
664
827
  orders.push(this.extend(request, params));
665
828
  if (hasStopLoss || hasTakeProfit) {
@@ -709,6 +872,12 @@ export default class lighter extends Exchange {
709
872
  if (nonceInOptions !== undefined) {
710
873
  return nonceInOptions;
711
874
  }
875
+ // avoid skipNonce for l1 operations
876
+ let skipNonce = true;
877
+ [skipNonce, params] = this.handleOptionAndParams(params, 'fetchNonce', 'skipNonce', true);
878
+ if (skipNonce) {
879
+ return this.milliseconds();
880
+ }
712
881
  const response = await this.publicGetNextNonce({ 'account_index': accountIndex, 'api_key_index': apiKeyIndex });
713
882
  return this.safeInteger(response, 'nonce');
714
883
  }
@@ -748,17 +917,14 @@ export default class lighter extends Exchange {
748
917
  if (totalOrderRequests > 0) {
749
918
  order = orderRequests[0];
750
919
  apiKeyIndex = order['api_key_index'];
751
- if (order['nonce'] === undefined) {
752
- const nonceInOptions = this.safeInteger(this.options, 'nonce');
753
- if (nonceInOptions !== undefined) {
754
- order['nonce'] = nonceInOptions;
755
- }
756
- else {
757
- order['nonce'] = await this.fetchNonce(accountIndex, apiKeyIndex);
758
- }
759
- }
760
920
  }
761
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
921
+ const strAccountIndex = this.numberToString(accountIndex);
922
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
923
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
924
+ // the nonce could be updated
925
+ if (this.safeInteger(order, 'nonce') === undefined) {
926
+ order['nonce'] = await this.fetchNonce(accountIndex, apiKeyIndex);
927
+ }
762
928
  let txType = undefined;
763
929
  let txInfo = undefined;
764
930
  if (totalOrderRequests < 2) {
@@ -772,6 +938,11 @@ export default class lighter extends Exchange {
772
938
  'api_key_index': apiKeyIndex,
773
939
  'account_index': accountIndex,
774
940
  };
941
+ if (this.safeBool(this.options, 'builderFee', true)) {
942
+ signingPayload['integrator_account_index'] = order['integrator_account_index'];
943
+ signingPayload['integrator_taker_fee'] = order['integrator_taker_fee'];
944
+ signingPayload['integrator_maker_fee'] = order['integrator_maker_fee'];
945
+ }
775
946
  [txType, txInfo] = this.lighterSignCreateGroupedOrders(signer, signingPayload);
776
947
  }
777
948
  const request = {
@@ -805,17 +976,16 @@ export default class lighter extends Exchange {
805
976
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
806
977
  */
807
978
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
808
- let apiKeyIndex = undefined;
809
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'editOrder', 'apiKeyIndex', 'api_key_index');
810
- if (apiKeyIndex === undefined) {
811
- throw new ArgumentsRequired(this.id + ' editOrder() requires an apiKeyIndex parameter');
812
- }
813
979
  await this.loadMarkets();
980
+ let apiKeyIndex = undefined;
981
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'editOrder', 'apiKeyIndex', 'api_key_index');
814
982
  let accountIndex = undefined;
815
983
  [accountIndex, params] = await this.handleAccountIndex(params, 'editOrder', 'accountIndex', 'account_index');
984
+ const strAccountIndex = this.numberToString(accountIndex);
985
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
986
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
816
987
  const market = this.market(symbol);
817
988
  const marketInfo = this.safeDict(market, 'info');
818
- const nonce = await this.fetchNonce(accountIndex, apiKeyIndex);
819
989
  const amountScale = this.pow('10', marketInfo['size_decimals']);
820
990
  const priceScale = this.pow('10', marketInfo['price_decimals']);
821
991
  const triggerPrice = this.safeStringN(params, ['stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
@@ -830,6 +1000,7 @@ export default class lighter extends Exchange {
830
1000
  else {
831
1001
  amountStr = this.amountToPrecision(symbol, amount);
832
1002
  }
1003
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
833
1004
  const signRaw = {
834
1005
  'market_index': this.parseToInt(market['id']),
835
1006
  'index': this.parseToInt(id),
@@ -839,8 +1010,10 @@ export default class lighter extends Exchange {
839
1010
  'nonce': nonce,
840
1011
  'api_key_index': apiKeyIndex,
841
1012
  'account_index': accountIndex,
1013
+ 'integrator_account_index': this.options['integratorAccountIndex'],
1014
+ 'integrator_taker_fee': this.options['integratorTakerFee'],
1015
+ 'integrator_maker_fee': this.options['integratorMakerFee'],
842
1016
  };
843
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
844
1017
  const [txType, txInfo] = this.lighterSignModifyOrder(signer, this.extend(signRaw, params));
845
1018
  const request = {
846
1019
  'tx_type': txType,
@@ -1075,7 +1248,9 @@ export default class lighter extends Exchange {
1075
1248
  */
1076
1249
  async fetchCurrencies(params = {}) {
1077
1250
  const response = await this.publicGetAssetDetails(params);
1078
- await this.preLoadLighterLibrary();
1251
+ if (this.checkRequiredCredentials(false)) {
1252
+ await this.preLoadLighterLibrary();
1253
+ }
1079
1254
  //
1080
1255
  // {
1081
1256
  // "code": 200,
@@ -1907,11 +2082,10 @@ export default class lighter extends Exchange {
1907
2082
  let accountIndex = undefined;
1908
2083
  [accountIndex, params] = await this.handleAccountIndex(params, 'fetchOpenOrders', 'accountIndex', 'account_index');
1909
2084
  let apiKeyIndex = undefined;
1910
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'fetchOpenOrders', 'apiKeyIndex', 'api_key_index');
1911
- if (apiKeyIndex === undefined) {
1912
- throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires an apiKeyIndex parameter');
1913
- }
1914
- await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2085
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'fetchOpenOrders', 'apiKeyIndex', 'api_key_index');
2086
+ const strAccountIndex = this.numberToString(accountIndex);
2087
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
2088
+ await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
1915
2089
  const market = this.market(symbol);
1916
2090
  const request = {
1917
2091
  'market_id': market['id'],
@@ -1983,11 +2157,10 @@ export default class lighter extends Exchange {
1983
2157
  let accountIndex = undefined;
1984
2158
  [accountIndex, params] = await this.handleAccountIndex(params, 'fetchClosedOrders', 'accountIndex', 'account_index');
1985
2159
  let apiKeyIndex = undefined;
1986
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'fetchClosedOrders', 'apiKeyIndex', 'api_key_index');
1987
- if (apiKeyIndex === undefined) {
1988
- throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires an apiKeyIndex parameter');
1989
- }
1990
- await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2160
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'fetchClosedOrders', 'apiKeyIndex', 'api_key_index');
2161
+ const strAccountIndex = this.numberToString(accountIndex);
2162
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
2163
+ await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
1991
2164
  const market = this.market(symbol);
1992
2165
  const request = {
1993
2166
  'market_id': market['id'],
@@ -2241,16 +2414,16 @@ export default class lighter extends Exchange {
2241
2414
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/?id=transfer-structure}
2242
2415
  */
2243
2416
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
2244
- let apiKeyIndex = undefined;
2245
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'transfer', 'apiKeyIndex', 'api_key_index');
2246
- if (apiKeyIndex === undefined) {
2247
- throw new ArgumentsRequired(this.id + ' transfer() requires an apiKeyIndex parameter');
2248
- }
2249
2417
  await this.loadMarkets();
2418
+ let apiKeyIndex = undefined;
2419
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'transfer', 'apiKeyIndex', 'api_key_index');
2250
2420
  let accountIndex = undefined;
2251
2421
  [accountIndex, params] = await this.handleAccountIndex(params, 'transfer', 'accountIndex', 'account_index');
2252
2422
  let toAccountIndex = undefined;
2253
2423
  [toAccountIndex, params] = this.handleOptionAndParams2(params, 'transfer', 'toAccountIndex', 'to_account_index', accountIndex);
2424
+ const strAccountIndex = this.numberToString(accountIndex);
2425
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
2426
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
2254
2427
  const currency = this.currency(code);
2255
2428
  if (currency['code'] === 'USDC') {
2256
2429
  amount = this.parseToInt(Precise.stringMul(this.pow('10', '6'), this.currencyToPrecision(code, amount)));
@@ -2263,9 +2436,9 @@ export default class lighter extends Exchange {
2263
2436
  }
2264
2437
  const fromRouteType = (fromAccount === 'perp') ? 0 : 1; // 0: perp, 1: spot
2265
2438
  const toRouteType = (toAccount === 'perp') ? 0 : 1;
2266
- const nonce = await this.fetchNonce(accountIndex, apiKeyIndex);
2267
2439
  const memo = this.safeString(params, 'memo', '0x000000000000000000000000000000');
2268
2440
  params = this.omit(params, ['memo']);
2441
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
2269
2442
  const signRaw = {
2270
2443
  'to_account_index': toAccountIndex,
2271
2444
  'asset_index': this.parseToInt(currency['id']),
@@ -2278,7 +2451,6 @@ export default class lighter extends Exchange {
2278
2451
  'api_key_index': apiKeyIndex,
2279
2452
  'account_index': accountIndex,
2280
2453
  };
2281
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2282
2454
  const [txType, txInfo] = this.lighterSignTransfer(signer, this.extend(signRaw, params));
2283
2455
  const request = {
2284
2456
  'tx_type': txType,
@@ -2301,6 +2473,7 @@ export default class lighter extends Exchange {
2301
2473
  * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/?id=transfer-structure}
2302
2474
  */
2303
2475
  async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
2476
+ await this.loadMarkets();
2304
2477
  let paginate = false;
2305
2478
  [paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
2306
2479
  if (paginate) {
@@ -2312,11 +2485,10 @@ export default class lighter extends Exchange {
2312
2485
  'account_index': accountIndex,
2313
2486
  };
2314
2487
  let apiKeyIndex = undefined;
2315
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'fetchTransfers', 'apiKeyIndex', 'api_key_index');
2316
- if (apiKeyIndex === undefined) {
2317
- throw new ArgumentsRequired(this.id + ' fetchTransfers() requires an apiKeyIndex parameter');
2318
- }
2319
- await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2488
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'fetchTransfers', 'apiKeyIndex', 'api_key_index');
2489
+ const strAccountIndex = this.numberToString(accountIndex);
2490
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
2491
+ await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
2320
2492
  let currency = undefined;
2321
2493
  if (code !== undefined) {
2322
2494
  currency = this.currency(code);
@@ -2403,6 +2575,7 @@ export default class lighter extends Exchange {
2403
2575
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/?id=transaction-structure}
2404
2576
  */
2405
2577
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
2578
+ await this.loadMarkets();
2406
2579
  let paginate = false;
2407
2580
  [paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
2408
2581
  if (paginate) {
@@ -2413,7 +2586,6 @@ export default class lighter extends Exchange {
2413
2586
  if (address === undefined) {
2414
2587
  throw new ArgumentsRequired(this.id + ' fetchDeposits() requires an address parameter');
2415
2588
  }
2416
- await this.loadMarkets();
2417
2589
  let accountIndex = undefined;
2418
2590
  [accountIndex, params] = await this.handleAccountIndex(params, 'fetchDeposits', 'accountIndex', 'account_index');
2419
2591
  const request = {
@@ -2421,11 +2593,10 @@ export default class lighter extends Exchange {
2421
2593
  'l1_address': address,
2422
2594
  };
2423
2595
  let apiKeyIndex = undefined;
2424
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'fetchDeposits', 'apiKeyIndex', 'api_key_index');
2425
- if (apiKeyIndex === undefined) {
2426
- throw new ArgumentsRequired(this.id + ' fetchDeposits() requires an apiKeyIndex parameter');
2427
- }
2428
- await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2596
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'fetchDeposits', 'apiKeyIndex', 'api_key_index');
2597
+ const strAccountIndex = this.numberToString(accountIndex);
2598
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
2599
+ await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
2429
2600
  let currency = undefined;
2430
2601
  if (code !== undefined) {
2431
2602
  currency = this.currency(code);
@@ -2482,11 +2653,10 @@ export default class lighter extends Exchange {
2482
2653
  'account_index': accountIndex,
2483
2654
  };
2484
2655
  let apiKeyIndex = undefined;
2485
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'fetchWithdrawals', 'apiKeyIndex', 'api_key_index');
2486
- if (apiKeyIndex === undefined) {
2487
- throw new ArgumentsRequired(this.id + ' fetchWithdrawals() requires an apiKeyIndex parameter');
2488
- }
2489
- await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2656
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'fetchWithdrawals', 'apiKeyIndex', 'api_key_index');
2657
+ const strAccountIndex = this.numberToString(accountIndex);
2658
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
2659
+ await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
2490
2660
  let currency = undefined;
2491
2661
  if (code !== undefined) {
2492
2662
  currency = this.currency(code);
@@ -2596,14 +2766,14 @@ export default class lighter extends Exchange {
2596
2766
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/?id=transaction-structure}
2597
2767
  */
2598
2768
  async withdraw(code, amount, address, tag = undefined, params = {}) {
2599
- let apiKeyIndex = undefined;
2600
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'withdraw', 'apiKeyIndex', 'api_key_index');
2601
- if (apiKeyIndex === undefined) {
2602
- throw new ArgumentsRequired(this.id + ' withdraw() requires an apiKeyIndex parameter');
2603
- }
2604
2769
  await this.loadMarkets();
2770
+ let apiKeyIndex = undefined;
2771
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'withdraw', 'apiKeyIndex', 'api_key_index');
2605
2772
  let accountIndex = undefined;
2606
2773
  [accountIndex, params] = await this.handleAccountIndex(params, 'withdraw', 'accountIndex', 'account_index');
2774
+ const strAccountIndex = this.numberToString(accountIndex);
2775
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
2776
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
2607
2777
  const currency = this.currency(code);
2608
2778
  if (currency['code'] === 'USDC') {
2609
2779
  amount = this.parseToInt(Precise.stringMul(this.pow('10', '6'), this.currencyToPrecision(code, amount)));
@@ -2616,7 +2786,7 @@ export default class lighter extends Exchange {
2616
2786
  }
2617
2787
  const routeType = this.safeInteger(params, 'routeType', 0); // 0: perp, 1: spot
2618
2788
  params = this.omit(params, 'routeType');
2619
- const nonce = await this.fetchNonce(accountIndex, apiKeyIndex);
2789
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
2620
2790
  const signRaw = {
2621
2791
  'asset_index': this.parseToInt(currency['id']),
2622
2792
  'route_type': routeType,
@@ -2625,7 +2795,6 @@ export default class lighter extends Exchange {
2625
2795
  'api_key_index': apiKeyIndex,
2626
2796
  'account_index': accountIndex,
2627
2797
  };
2628
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2629
2798
  const [txType, txInfo] = this.lighterSignWithdraw(signer, this.extend(signRaw, params));
2630
2799
  const request = {
2631
2800
  'tx_type': txType,
@@ -2658,11 +2827,10 @@ export default class lighter extends Exchange {
2658
2827
  let accountIndex = undefined;
2659
2828
  [accountIndex, params] = await this.handleAccountIndex(params, 'fetchMyTrades', 'accountIndex', 'account_index');
2660
2829
  let apiKeyIndex = undefined;
2661
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'fetchMyTrades', 'apiKeyIndex', 'api_key_index');
2662
- if (apiKeyIndex === undefined) {
2663
- throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires an apiKeyIndex parameter');
2664
- }
2665
- await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2830
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'fetchMyTrades', 'apiKeyIndex', 'api_key_index');
2831
+ const strAccountIndex = this.numberToString(accountIndex);
2832
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
2833
+ await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
2666
2834
  const request = {
2667
2835
  'sort_by': 'timestamp',
2668
2836
  'limit': 100,
@@ -2838,22 +3006,22 @@ export default class lighter extends Exchange {
2838
3006
  return await this.modifyLeverageAndMarginMode(leverage, marginMode, symbol, params);
2839
3007
  }
2840
3008
  async modifyLeverageAndMarginMode(leverage, marginMode, symbol = undefined, params = {}) {
3009
+ await this.loadMarkets();
2841
3010
  if ((marginMode !== 'cross') && (marginMode !== 'isolated')) {
2842
3011
  throw new BadRequest(this.id + ' modifyLeverageAndMarginMode() requires a marginMode parameter that must be either cross or isolated');
2843
3012
  }
2844
3013
  let apiKeyIndex = undefined;
2845
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'modifyLeverageAndMarginMode', 'apiKeyIndex', 'api_key_index');
2846
- if (apiKeyIndex === undefined) {
2847
- throw new ArgumentsRequired(this.id + ' modifyLeverageAndMarginMode() requires an apiKeyIndex parameter');
2848
- }
3014
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'modifyLeverageAndMarginMode', 'apiKeyIndex', 'api_key_index');
2849
3015
  if (symbol === undefined) {
2850
3016
  throw new ArgumentsRequired(this.id + ' modifyLeverageAndMarginMode() requires a symbol argument');
2851
3017
  }
2852
- await this.loadMarkets();
2853
3018
  let accountIndex = undefined;
2854
3019
  [accountIndex, params] = await this.handleAccountIndex(params, 'modifyLeverageAndMarginMode', 'accountIndex', 'account_index');
3020
+ const strAccountIndex = this.numberToString(accountIndex);
3021
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
3022
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
2855
3023
  const market = this.market(symbol);
2856
- const nonce = await this.fetchNonce(accountIndex, apiKeyIndex);
3024
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
2857
3025
  const signRaw = {
2858
3026
  'market_index': this.parseToInt(market['id']),
2859
3027
  'initial_margin_fraction': this.parseToInt(10000 / leverage),
@@ -2862,7 +3030,6 @@ export default class lighter extends Exchange {
2862
3030
  'api_key_index': apiKeyIndex,
2863
3031
  'account_index': accountIndex,
2864
3032
  };
2865
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2866
3033
  const [txType, txInfo] = this.lighterSignUpdateLeverage(signer, this.extend(signRaw, params));
2867
3034
  const request = {
2868
3035
  'tx_type': txType,
@@ -2882,21 +3049,21 @@ export default class lighter extends Exchange {
2882
3049
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
2883
3050
  */
2884
3051
  async cancelOrder(id, symbol = undefined, params = {}) {
3052
+ await this.loadMarkets();
2885
3053
  let apiKeyIndex = undefined;
2886
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'cancelOrder', 'apiKeyIndex', 'api_key_index');
2887
- if (apiKeyIndex === undefined) {
2888
- throw new ArgumentsRequired(this.id + ' cancelOrder() requires an apiKeyIndex parameter');
2889
- }
3054
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'cancelOrder', 'apiKeyIndex', 'api_key_index');
2890
3055
  if (symbol === undefined) {
2891
3056
  throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
2892
3057
  }
3058
+ const market = this.market(symbol);
2893
3059
  const clientOrderId = this.safeString2(params, 'client_order_index', 'clientOrderId');
2894
3060
  params = this.omit(params, ['client_order_index', 'clientOrderId']);
2895
- await this.loadMarkets();
2896
3061
  let accountIndex = undefined;
2897
3062
  [accountIndex, params] = await this.handleAccountIndex(params, 'cancelOrder', 'accountIndex', 'account_index');
2898
- const market = this.market(symbol);
2899
- const nonce = await this.fetchNonce(accountIndex, apiKeyIndex);
3063
+ const strAccountIndex = this.numberToString(accountIndex);
3064
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
3065
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
3066
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
2900
3067
  const signRaw = {
2901
3068
  'market_index': this.parseToInt(market['id']),
2902
3069
  'nonce': nonce,
@@ -2912,7 +3079,6 @@ export default class lighter extends Exchange {
2912
3079
  else {
2913
3080
  throw new ArgumentsRequired(this.id + ' cancelOrder requires order id or client order id');
2914
3081
  }
2915
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2916
3082
  const [txType, txInfo] = this.lighterSignCancelOrder(signer, this.extend(signRaw, params));
2917
3083
  const request = {
2918
3084
  'tx_type': txType,
@@ -2932,13 +3098,14 @@ export default class lighter extends Exchange {
2932
3098
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
2933
3099
  */
2934
3100
  async cancelAllOrders(symbol = undefined, params = {}) {
3101
+ await this.loadMarkets();
2935
3102
  let apiKeyIndex = undefined;
2936
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'cancelAllOrders', 'apiKeyIndex', 'api_key_index');
2937
- if (apiKeyIndex === undefined) {
2938
- throw new ArgumentsRequired(this.id + ' cancelAllOrders() requires an apiKeyIndex parameter');
2939
- }
3103
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'cancelAllOrders', 'apiKeyIndex', 'api_key_index');
2940
3104
  let accountIndex = undefined;
2941
3105
  [accountIndex, params] = await this.handleAccountIndex(params, 'cancelAllOrders', 'accountIndex', 'account_index');
3106
+ const strAccountIndex = this.numberToString(accountIndex);
3107
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
3108
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
2942
3109
  const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
2943
3110
  const signRaw = {
2944
3111
  'time_in_force': 0,
@@ -2947,7 +3114,6 @@ export default class lighter extends Exchange {
2947
3114
  'api_key_index': apiKeyIndex,
2948
3115
  'account_index': accountIndex,
2949
3116
  };
2950
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2951
3117
  const [txType, txInfo] = this.lighterSignCancelAllOrders(signer, this.extend(signRaw, params));
2952
3118
  const request = {
2953
3119
  'tx_type': txType,
@@ -2965,17 +3131,18 @@ export default class lighter extends Exchange {
2965
3131
  * @returns {object} the api result
2966
3132
  */
2967
3133
  async cancelAllOrdersAfter(timeout, params = {}) {
3134
+ await this.loadMarkets();
2968
3135
  if ((timeout < 300000) || (timeout > 1296000000)) {
2969
3136
  throw new BadRequest(this.id + ' timeout should be between 5 minutes and 15 days.');
2970
3137
  }
2971
3138
  let apiKeyIndex = undefined;
2972
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'cancelOrder', 'apiKeyIndex', 'api_key_index');
2973
- if (apiKeyIndex === undefined) {
2974
- throw new ArgumentsRequired(this.id + ' cancelAllOrdersAfter() requires an apiKeyIndex parameter');
2975
- }
3139
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'cancelOrder', 'apiKeyIndex', 'api_key_index');
2976
3140
  let accountIndex = undefined;
2977
3141
  [accountIndex, params] = await this.handleAccountIndex(params, 'cancelAllOrdersAfter', 'accountIndex', 'account_index');
2978
- const nonce = await this.fetchNonce(accountIndex, apiKeyIndex);
3142
+ const strAccountIndex = this.numberToString(accountIndex);
3143
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
3144
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
3145
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
2979
3146
  const signRaw = {
2980
3147
  'time_in_force': 1,
2981
3148
  'time': this.milliseconds() + timeout,
@@ -2983,7 +3150,6 @@ export default class lighter extends Exchange {
2983
3150
  'api_key_index': apiKeyIndex,
2984
3151
  'account_index': accountIndex,
2985
3152
  };
2986
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
2987
3153
  const [txType, txInfo] = this.lighterSignCancelAllOrders(signer, this.extend(signRaw, params));
2988
3154
  const request = {
2989
3155
  'tx_type': txType,
@@ -3034,11 +3200,9 @@ export default class lighter extends Exchange {
3034
3200
  * @returns {object} A [margin structure]{@link https://docs.ccxt.com/?id=add-margin-structure}
3035
3201
  */
3036
3202
  async setMargin(symbol, amount, params = {}) {
3203
+ await this.loadMarkets();
3037
3204
  let apiKeyIndex = undefined;
3038
- [apiKeyIndex, params] = this.handleOptionAndParams2(params, 'setMargin', 'apiKeyIndex', 'api_key_index');
3039
- if (apiKeyIndex === undefined) {
3040
- throw new ArgumentsRequired(this.id + ' setMargin() requires an apiKeyIndex parameter');
3041
- }
3205
+ [apiKeyIndex, params] = this.handleApiKeyIndex(params, 'setMargin', 'apiKeyIndex', 'api_key_index');
3042
3206
  const direction = this.safeInteger(params, 'direction'); // 1 increase margin 0 decrease margin
3043
3207
  if (direction === undefined) {
3044
3208
  throw new ArgumentsRequired(this.id + ' setMargin() requires a direction parameter either 1 (increase margin) or 0 (decrease margin)');
@@ -3049,11 +3213,13 @@ export default class lighter extends Exchange {
3049
3213
  if (symbol === undefined) {
3050
3214
  throw new ArgumentsRequired(this.id + ' setMargin() requires a symbol argument');
3051
3215
  }
3052
- await this.loadMarkets();
3053
3216
  let accountIndex = undefined;
3054
3217
  [accountIndex, params] = await this.handleAccountIndex(params, 'setMargin', 'accountIndex', 'account_index');
3218
+ const strAccountIndex = this.numberToString(accountIndex);
3219
+ const strApiKeyIndex = this.numberToString(apiKeyIndex);
3220
+ const signer = await this.loadAccount(this.options['chainId'], this.getLighterPrivateKey(strAccountIndex, strApiKeyIndex), strApiKeyIndex, strAccountIndex, params);
3055
3221
  const market = this.market(symbol);
3056
- const nonce = await this.fetchNonce(accountIndex, apiKeyIndex);
3222
+ const nonce = await this.fetchNonce(accountIndex, apiKeyIndex, params);
3057
3223
  const signRaw = {
3058
3224
  'market_index': this.parseToInt(market['id']),
3059
3225
  'usdc_amount': this.parseToInt(Precise.stringMul(this.pow('10', '6'), this.currencyToPrecision('USDC', amount))),
@@ -3062,7 +3228,6 @@ export default class lighter extends Exchange {
3062
3228
  'api_key_index': apiKeyIndex,
3063
3229
  'account_index': accountIndex,
3064
3230
  };
3065
- const signer = await this.loadAccount(this.options['chainId'], this.privateKey, apiKeyIndex, accountIndex, params);
3066
3231
  const [txType, txInfo] = this.lighterSignUpdateMargin(signer, this.extend(signRaw, params));
3067
3232
  const request = {
3068
3233
  'tx_type': txType,