ccxt 4.5.40 → 4.5.42

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 (106) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +18 -18
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/lighter.js +11 -0
  5. package/dist/cjs/src/ascendex.js +73 -1
  6. package/dist/cjs/src/base/Exchange.js +149 -17
  7. package/dist/cjs/src/base/functions/generic.js +1 -0
  8. package/dist/cjs/src/base/functions/io.js +160 -0
  9. package/dist/cjs/src/base/functions.js +6 -0
  10. package/dist/cjs/src/base/ws/Client.js +1 -0
  11. package/dist/cjs/src/base/ws/WsClient.js +1 -0
  12. package/dist/cjs/src/binance.js +1 -0
  13. package/dist/cjs/src/bingx.js +13 -3
  14. package/dist/cjs/src/bitmex.js +20 -0
  15. package/dist/cjs/src/blofin.js +2 -2
  16. package/dist/cjs/src/bybit.js +1 -1
  17. package/dist/cjs/src/coinspot.js +7 -2
  18. package/dist/cjs/src/delta.js +1 -1
  19. package/dist/cjs/src/gate.js +11 -4
  20. package/dist/cjs/src/gemini.js +76 -1
  21. package/dist/cjs/src/htx.js +2 -2
  22. package/dist/cjs/src/hyperliquid.js +20 -7
  23. package/dist/cjs/src/independentreserve.js +7 -7
  24. package/dist/cjs/src/kraken.js +1 -1
  25. package/dist/cjs/src/krakenfutures.js +96 -5
  26. package/dist/cjs/src/kucoin.js +3 -3
  27. package/dist/cjs/src/kucoinfutures.js +1 -1
  28. package/dist/cjs/src/lighter.js +2931 -0
  29. package/dist/cjs/src/mexc.js +0 -1
  30. package/dist/cjs/src/phemex.js +1 -1
  31. package/dist/cjs/src/pro/binance.js +2 -2
  32. package/dist/cjs/src/pro/bingx.js +215 -2
  33. package/dist/cjs/src/pro/bitget.js +1 -0
  34. package/dist/cjs/src/pro/defx.js +1 -1
  35. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  36. package/dist/cjs/src/pro/lighter.js +787 -0
  37. package/dist/cjs/src/pro/mexc.js +1 -1
  38. package/dist/cjs/src/pro/paradex.js +1 -1
  39. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +1 -0
  40. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -0
  41. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +1 -0
  42. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +1 -0
  43. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +1 -0
  44. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +1 -0
  45. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +1 -0
  46. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +1 -0
  47. package/dist/cjs/src/static_dependencies/ethers/fragments.js +1 -0
  48. package/dist/cjs/src/static_dependencies/ethers/index.js +1 -0
  49. package/dist/cjs/src/static_dependencies/ethers/interface.js +1 -0
  50. package/dist/cjs/src/static_dependencies/ethers/typed.js +1 -0
  51. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +1 -0
  52. package/dist/cjs/src/whitebit.js +118 -16
  53. package/dist/cjs/src/woo.js +1 -1
  54. package/js/ccxt.d.ts +8 -2
  55. package/js/ccxt.js +6 -2
  56. package/js/src/abstract/gemini.d.ts +27 -0
  57. package/js/src/abstract/lighter.d.ts +53 -0
  58. package/js/src/abstract/lighter.js +11 -0
  59. package/js/src/ascendex.d.ts +12 -1
  60. package/js/src/ascendex.js +73 -1
  61. package/js/src/base/Exchange.d.ts +18 -6
  62. package/js/src/base/Exchange.js +154 -21
  63. package/js/src/base/functions/generic.js +1 -0
  64. package/js/src/base/functions/io.d.ts +32 -0
  65. package/js/src/base/functions/io.js +137 -0
  66. package/js/src/base/functions.d.ts +1 -0
  67. package/js/src/base/functions.js +1 -0
  68. package/js/src/binance.d.ts +1 -0
  69. package/js/src/binance.js +1 -0
  70. package/js/src/bingx.js +13 -3
  71. package/js/src/bitmex.js +20 -0
  72. package/js/src/blofin.js +2 -2
  73. package/js/src/bybit.js +1 -1
  74. package/js/src/coinspot.js +7 -2
  75. package/js/src/delta.js +1 -1
  76. package/js/src/gate.d.ts +1 -0
  77. package/js/src/gate.js +11 -4
  78. package/js/src/gemini.d.ts +11 -0
  79. package/js/src/gemini.js +76 -1
  80. package/js/src/htx.js +2 -2
  81. package/js/src/hyperliquid.js +20 -7
  82. package/js/src/independentreserve.js +7 -7
  83. package/js/src/kraken.js +1 -1
  84. package/js/src/krakenfutures.d.ts +1 -1
  85. package/js/src/krakenfutures.js +96 -5
  86. package/js/src/kucoin.d.ts +3 -3
  87. package/js/src/kucoin.js +3 -3
  88. package/js/src/kucoinfutures.js +1 -1
  89. package/js/src/lighter.d.ts +424 -0
  90. package/js/src/lighter.js +2930 -0
  91. package/js/src/mexc.js +0 -1
  92. package/js/src/phemex.js +1 -1
  93. package/js/src/pro/binance.js +2 -2
  94. package/js/src/pro/bingx.d.ts +17 -1
  95. package/js/src/pro/bingx.js +216 -3
  96. package/js/src/pro/bitget.js +1 -0
  97. package/js/src/pro/defx.js +1 -1
  98. package/js/src/pro/kucoinfutures.js +1 -1
  99. package/js/src/pro/lighter.d.ts +161 -0
  100. package/js/src/pro/lighter.js +786 -0
  101. package/js/src/pro/mexc.js +1 -1
  102. package/js/src/pro/paradex.js +1 -1
  103. package/js/src/whitebit.d.ts +2 -1
  104. package/js/src/whitebit.js +118 -16
  105. package/js/src/woo.js +1 -1
  106. package/package.json +1 -1
@@ -0,0 +1,424 @@
1
+ import Exchange from './abstract/lighter.js';
2
+ import type { Dict, FundingRate, FundingRates, Int, int, Market, OHLCV, OrderBook, Strings, Ticker, Tickers, OrderType, OrderSide, Num, Order, Balances, Position, Str, TransferEntry, Currency, Currencies, Transaction, Trade, Account, MarginModification } from './base/types.js';
3
+ /**
4
+ * @class lighter
5
+ * @augments Exchange
6
+ */
7
+ export default class lighter extends Exchange {
8
+ describe(): any;
9
+ loadAccount(chainId: any, privateKey: any, apiKeyIndex: any, accountIndex: any, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
10
+ handleAccountIndex(params: object, methodName1: string, optionName1: string, optionName2: string, defaultValue?: any): Promise<any[]>;
11
+ createSubAccount(name: string, params?: {}): Promise<any>;
12
+ createAuth(params?: {}): string;
13
+ pow(n: string, m: string): string;
14
+ setSandboxMode(enable: boolean): void;
15
+ createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): any[];
16
+ fetchNonce(accountIndex: any, apiKeyIndex: any, params?: {}): Promise<number>;
17
+ /**
18
+ * @method
19
+ * @name lighter#createOrder
20
+ * @description create a trade order
21
+ * @param {string} symbol unified symbol of the market to create an order in
22
+ * @param {string} type 'market' or 'limit'
23
+ * @param {string} side 'buy' or 'sell'
24
+ * @param {float} amount how much of currency you want to trade in units of base currency
25
+ * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
26
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
27
+ * @param {string} [params.timeInForce] 'GTT' or 'IOC', default is 'GTT'
28
+ * @param {int} [params.clientOrderId] client order id, should be unique for each order, default is a random number
29
+ * @param {string} [params.triggerPrice] trigger price for stop loss or take profit orders, in units of the quote currency
30
+ * @param {boolean} [params.reduceOnly] whether the order is reduce only, default false
31
+ * @param {int} [params.nonce] nonce for the account
32
+ * @param {int} [params.apiKeyIndex] apiKeyIndex
33
+ * @param {int} [params.accountIndex] accountIndex
34
+ * @param {int} [params.orderExpiry] orderExpiry
35
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
36
+ */
37
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
38
+ /**
39
+ * @method
40
+ * @name lighter#editOrder
41
+ * @description cancels an order and places a new order
42
+ * @param {string} id order id
43
+ * @param {string} symbol unified symbol of the market to create an order in
44
+ * @param {string} type 'market' or 'limit'
45
+ * @param {string} side 'buy' or 'sell'
46
+ * @param {float} amount how much of the currency you want to trade in units of the base currency
47
+ * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
48
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
49
+ * @param {string} [params.accountIndex] account index
50
+ * @param {string} [params.apiKeyIndex] api key index
51
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
52
+ */
53
+ editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
54
+ /**
55
+ * @method
56
+ * @name lighter#fetchStatus
57
+ * @description the latest known information on the availability of the exchange API
58
+ * @see https://apidocs.lighter.xyz/reference/status
59
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
60
+ * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
61
+ */
62
+ fetchStatus(params?: {}): Promise<{
63
+ status: string;
64
+ updated: any;
65
+ eta: any;
66
+ url: any;
67
+ info: any;
68
+ }>;
69
+ /**
70
+ * @method
71
+ * @name lighter#fetchTime
72
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
73
+ * @see https://apidocs.lighter.xyz/reference/status
74
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
75
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
76
+ */
77
+ fetchTime(params?: {}): Promise<Int>;
78
+ /**
79
+ * @method
80
+ * @name lighter#fetchMarkets
81
+ * @description retrieves data on all markets for lighter
82
+ * @see https://apidocs.lighter.xyz/reference/orderbookdetails
83
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
84
+ * @returns {object[]} an array of objects representing market data
85
+ */
86
+ fetchMarkets(params?: {}): Promise<Market[]>;
87
+ /**
88
+ * @method
89
+ * @name lighter#fetchCurrencies
90
+ * @description fetches all available currencies on an exchange
91
+ * @see https://apidocs.lighter.xyz/reference/assetdetails
92
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
93
+ * @returns {object} an associative dictionary of currencies
94
+ */
95
+ fetchCurrencies(params?: {}): Promise<Currencies>;
96
+ /**
97
+ * @method
98
+ * @name lighter#fetchOrderBook
99
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
100
+ * @see https://apidocs.lighter.xyz/reference/orderbookorders
101
+ * @param {string} symbol unified symbol of the market to fetch the order book for
102
+ * @param {int} [limit] the maximum amount of order book entries to return
103
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
104
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
105
+ */
106
+ fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
107
+ parseTicker(ticker: Dict, market?: Market): Ticker;
108
+ /**
109
+ * @method
110
+ * @name lighter#fetchTicker
111
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
112
+ * @see https://apidocs.lighter.xyz/reference/orderbookdetails
113
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
114
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
115
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
116
+ */
117
+ fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
118
+ /**
119
+ * @method
120
+ * @name lighter#fetchTickers
121
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
122
+ * @see https://apidocs.lighter.xyz/reference/orderbookdetails
123
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
124
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
125
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
126
+ */
127
+ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
128
+ parseOHLCV(ohlcv: any, market?: Market): OHLCV;
129
+ /**
130
+ * @method
131
+ * @name lighter#fetchOHLCV
132
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
133
+ * @see https://apidocs.lighter.xyz/reference/candles
134
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
135
+ * @param {string} timeframe the length of time each candle represents
136
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
137
+ * @param {int} [limit] the maximum amount of candles to fetch
138
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
139
+ * @param {int} [params.until] timestamp in ms of the latest candle to fetch
140
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
141
+ */
142
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
143
+ parseFundingRate(contract: any, market?: Market): FundingRate;
144
+ /**
145
+ * @method
146
+ * @name lighter#fetchFundingRates
147
+ * @description fetch the current funding rate for multiple symbols
148
+ * @see https://apidocs.lighter.xyz/reference/funding-rates
149
+ * @param {string[]} [symbols] list of unified market symbols
150
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
151
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
152
+ */
153
+ fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
154
+ /**
155
+ * @method
156
+ * @name ligher#fetchBalance
157
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
158
+ * @see https://apidocs.lighter.xyz/reference/account-1
159
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
160
+ * @param {string} [params.by] fetch balance by 'index' or 'l1_address', defaults to 'index'
161
+ * @param {string} [params.value] fetch balance value, account index or l1 address
162
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
163
+ */
164
+ fetchBalance(params?: {}): Promise<Balances>;
165
+ /**
166
+ * @method
167
+ * @name lighter#fetchPosition
168
+ * @description fetch data on an open position
169
+ * @see https://apidocs.lighter.xyz/reference/account-1
170
+ * @param {string} symbol unified market symbol of the market the position is held in
171
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
172
+ * @param {string} [params.by] fetch balance by 'index' or 'l1_address', defaults to 'index'
173
+ * @param {string} [params.value] fetch balance value, account index or l1 address
174
+ * @returns {object} a [position structure]{@link https://docs.ccxt.com/?id=position-structure}
175
+ */
176
+ fetchPosition(symbol: string, params?: {}): Promise<Position>;
177
+ /**
178
+ * @method
179
+ * @name lighter#fetchPositions
180
+ * @description fetch all open positions
181
+ * @see https://apidocs.lighter.xyz/reference/account-1
182
+ * @param {string[]} [symbols] list of unified market symbols
183
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
184
+ * @param {string} [params.by] fetch balance by 'index' or 'l1_address', defaults to 'index'
185
+ * @param {string} [params.value] fetch balance value, account index or l1 address
186
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/?id=position-structure}
187
+ */
188
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
189
+ parsePosition(position: Dict, market?: Market): Position;
190
+ /**
191
+ * @method
192
+ * @name lighter#fetchAccounts
193
+ * @description fetch all the accounts associated with a profile
194
+ * @see https://apidocs.lighter.xyz/reference/account-1
195
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
196
+ * @param {string} [params.by] fetch balance by 'index' or 'l1_address', defaults to 'index'
197
+ * @param {string} [params.value] fetch balance value, account index or l1 address
198
+ * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/?id=accounts-structure} indexed by the account type
199
+ */
200
+ fetchAccounts(params?: {}): Promise<Account[]>;
201
+ parseAccount(account: any): {
202
+ id: string;
203
+ type: string;
204
+ code: any;
205
+ info: any;
206
+ };
207
+ /**
208
+ * @method
209
+ * @name lighter#fetchOpenOrders
210
+ * @description fetch all unfilled currently open orders
211
+ * @see https://apidocs.lighter.xyz/reference/accountactiveorders
212
+ * @param {string} symbol unified market symbol
213
+ * @param {int} [since] the earliest time in ms to fetch open orders for
214
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
215
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
216
+ * @param {string} [params.accountIndex] account index
217
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
218
+ */
219
+ fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
220
+ /**
221
+ * @method
222
+ * @name lighter#fetchClosedOrders
223
+ * @description fetch all unfilled currently closed orders
224
+ * @see https://apidocs.lighter.xyz/reference/accountinactiveorders
225
+ * @param {string} symbol unified market symbol
226
+ * @param {int} [since] the earliest time in ms to fetch open orders for
227
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
228
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
229
+ * @param {string} [params.accountIndex] account index
230
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
231
+ */
232
+ fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
233
+ parseOrder(order: Dict, market?: Market): Order;
234
+ parseOrderStatus(status: Str): string;
235
+ parseOrderType(status: any): string;
236
+ parseOrderTimeInForeces(tif: any): string;
237
+ /**
238
+ * @method
239
+ * @name lighter#transfer
240
+ * @description transfer currency internally between wallets on the same account
241
+ * @param {string} code unified currency code
242
+ * @param {float} amount amount to transfer
243
+ * @param {string} fromAccount account to transfer from (spot, perp)
244
+ * @param {string} toAccount account to transfer to (spot, perp)
245
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
246
+ * @param {string} [params.accountIndex] account index
247
+ * @param {string} [params.toAccountIndex] to account index, defaults to fromAccountIndex
248
+ * @param {string} [params.apiKeyIndex] api key index
249
+ * @param {string} [params.memo] hex encoding memo
250
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/?id=transfer-structure}
251
+ */
252
+ transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
253
+ /**
254
+ * @method
255
+ * @name lighter#fetchTransfers
256
+ * @description fetch a history of internal transfers made on an account
257
+ * @see https://apidocs.lighter.xyz/reference/transfer_history
258
+ * @param {string} code unified currency code of the currency transferred
259
+ * @param {int} [since] the earliest time in ms to fetch transfers for
260
+ * @param {int} [limit] the maximum number of transfers structures to retrieve
261
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
262
+ * @param {string} [params.accountIndex] account index
263
+ * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/?id=transfer-structure}
264
+ */
265
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
266
+ parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
267
+ /**
268
+ * @method
269
+ * @name lighter#fetchDeposits
270
+ * @description fetch all deposits made to an account
271
+ * @see https://apidocs.lighter.xyz/reference/deposit_history
272
+ * @param {string} [code] unified currency code
273
+ * @param {int} [since] the earliest time in ms to fetch deposits for
274
+ * @param {int} [limit] the maximum number of deposits structures to retrieve
275
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
276
+ * @param {string} [params.accountIndex] account index
277
+ * @param {string} [params.address] l1_address
278
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/?id=transaction-structure}
279
+ */
280
+ fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
281
+ /**
282
+ * @method
283
+ * @name lighter#fetchWithdrawals
284
+ * @description fetch all withdrawals made from an account
285
+ * @see https://apidocs.lighter.xyz/reference/withdraw_history
286
+ * @param {string} [code] unified currency code
287
+ * @param {int} [since] the earliest time in ms to fetch withdrawals for
288
+ * @param {int} [limit] the maximum number of withdrawals structures to retrieve
289
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
290
+ * @param {string} [params.accountIndex] account index
291
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/?id=transaction-structure}
292
+ */
293
+ fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
294
+ parseTransaction(transaction: Dict, currency?: Currency): Transaction;
295
+ parseTransactionStatus(status: Str): string;
296
+ /**
297
+ * @method
298
+ * @name lighter#withdraw
299
+ * @description make a withdrawal
300
+ * @param {string} code unified currency code
301
+ * @param {float} amount the amount to withdraw
302
+ * @param {string} address the address to withdraw to
303
+ * @param {string} [tag]
304
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
305
+ * @param {string} [params.accountIndex] account index
306
+ * @param {string} [params.apiKeyIndex] api key index
307
+ * @param {int} [params.routeType] wallet type, 0: perp, 1: spot, default is 0
308
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/?id=transaction-structure}
309
+ */
310
+ withdraw(code: string, amount: number, address: string, tag?: Str, params?: {}): Promise<Transaction>;
311
+ /**
312
+ * @method
313
+ * @name lighter#fetchMyTrades
314
+ * @description fetch all trades made by the user
315
+ * @see https://apidocs.lighter.xyz/reference/trades
316
+ * @param {string} [symbol] unified market symbol
317
+ * @param {int} [since] the earliest time in ms to fetch trades for
318
+ * @param {int} [limit] the maximum number of trades structures to retrieve
319
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
320
+ * @param {string} [params.accountIndex] account index
321
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/?id=trade-structure}
322
+ */
323
+ fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
324
+ parseTrade(trade: Dict, market?: Market): Trade;
325
+ /**
326
+ * @method
327
+ * @name lighter#setLeverage
328
+ * @description set the level of leverage for a market
329
+ * @param {float} leverage the rate of leverage
330
+ * @param {string} symbol unified market symbol
331
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
332
+ * @param {string} [params.accountIndex] account index
333
+ * @param {string} [params.apiKeyIndex] api key index
334
+ * @param {string} [params.marginMode] margin mode, 'cross' or 'isolated'
335
+ * @returns {object} response from the exchange
336
+ */
337
+ setLeverage(leverage: int, symbol?: Str, params?: {}): Promise<any>;
338
+ /**
339
+ * @method
340
+ * @name lighter#setMarginMode
341
+ * @description set margin mode to 'cross' or 'isolated'
342
+ * @param {string} marginMode 'cross' or 'isolated'
343
+ * @param {string} symbol unified market symbol
344
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
345
+ * @param {string} [params.accountIndex] account index
346
+ * @param {string} [params.apiKeyIndex] api key index
347
+ * @param {int} [params.leverage] required leverage
348
+ * @returns {object} response from the exchange
349
+ */
350
+ setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
351
+ modifyLeverageAndMarginMode(leverage: int, marginMode: string, symbol?: Str, params?: {}): Promise<any>;
352
+ /**
353
+ * @method
354
+ * @name lighter#cancelOrder
355
+ * @description cancels an open order
356
+ * @param {string} id order id
357
+ * @param {string} symbol unified symbol of the market the order was made in
358
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
359
+ * @param {string} [params.accountIndex] account index
360
+ * @param {string} [params.apiKeyIndex] api key index
361
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
362
+ */
363
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
364
+ /**
365
+ * @method
366
+ * @name lighter#cancelAllOrders
367
+ * @description cancel all open orders
368
+ * @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
369
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
370
+ * @param {string} [params.accountIndex] account index
371
+ * @param {string} [params.apiKeyIndex] api key index
372
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
373
+ */
374
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
375
+ /**
376
+ * @method
377
+ * @name lighter#cancelAllOrdersAfter
378
+ * @description dead man's switch, cancel all orders after the given timeout
379
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
380
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
381
+ * @returns {object} the api result
382
+ */
383
+ cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
384
+ /**
385
+ * @method
386
+ * @name lighter#addMargin
387
+ * @description add margin
388
+ * @param {string} symbol unified market symbol
389
+ * @param {float} amount amount of margin to add
390
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
391
+ * @returns {object} a [margin structure]{@link https://docs.ccxt.com/?id=add-margin-structure}
392
+ */
393
+ addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
394
+ /**
395
+ * @method
396
+ * @name lighter#reduceMargin
397
+ * @description remove margin from a position
398
+ * @param {string} symbol unified market symbol
399
+ * @param {float} amount the amount of margin to remove
400
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
401
+ * @returns {object} a [margin structure]{@link https://docs.ccxt.com/?id=reduce-margin-structure}
402
+ */
403
+ reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
404
+ /**
405
+ * @method
406
+ * @name lighter#setMargin
407
+ * @description Either adds or reduces margin in an isolated position in order to set the margin to a specific value
408
+ * @param {string} symbol unified market symbol of the market to set margin in
409
+ * @param {float} amount the amount to set the margin to
410
+ * @param {object} [params] parameters specific to the bingx api endpoint
411
+ * @param {string} [params.accountIndex] account index
412
+ * @param {string} [params.apiKeyIndex] api key index
413
+ * @returns {object} A [margin structure]{@link https://docs.ccxt.com/?id=add-margin-structure}
414
+ */
415
+ setMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
416
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
417
+ sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
418
+ url: any;
419
+ method: string;
420
+ body: any;
421
+ headers: any;
422
+ };
423
+ handleErrors(httpCode: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
424
+ }