lighter-sdk-client 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +574 -0
- package/dist/api/exchange/change-account-tier.cjs +6 -0
- package/dist/api/exchange/change-account-tier.d.cts +14 -0
- package/dist/api/exchange/change-account-tier.d.ts +14 -0
- package/dist/api/exchange/change-account-tier.js +6 -0
- package/dist/api/exchange/fastwithdraw.cjs +6 -0
- package/dist/api/exchange/fastwithdraw.d.cts +14 -0
- package/dist/api/exchange/fastwithdraw.d.ts +14 -0
- package/dist/api/exchange/fastwithdraw.js +6 -0
- package/dist/api/exchange/index.cjs +37 -0
- package/dist/api/exchange/index.d.cts +8 -0
- package/dist/api/exchange/index.d.ts +8 -0
- package/dist/api/exchange/index.js +37 -0
- package/dist/api/exchange/notification-ack.cjs +6 -0
- package/dist/api/exchange/notification-ack.d.cts +13 -0
- package/dist/api/exchange/notification-ack.d.ts +13 -0
- package/dist/api/exchange/notification-ack.js +6 -0
- package/dist/api/exchange/send-tx-batch.cjs +6 -0
- package/dist/api/exchange/send-tx-batch.d.cts +22 -0
- package/dist/api/exchange/send-tx-batch.d.ts +22 -0
- package/dist/api/exchange/send-tx-batch.js +6 -0
- package/dist/api/exchange/send-tx.cjs +12 -0
- package/dist/api/exchange/send-tx.d.cts +33 -0
- package/dist/api/exchange/send-tx.d.ts +33 -0
- package/dist/api/exchange/send-tx.js +12 -0
- package/dist/api/exchange/tokens-create.cjs +6 -0
- package/dist/api/exchange/tokens-create.d.cts +24 -0
- package/dist/api/exchange/tokens-create.d.ts +24 -0
- package/dist/api/exchange/tokens-create.js +6 -0
- package/dist/api/exchange/tokens-revoke.cjs +6 -0
- package/dist/api/exchange/tokens-revoke.d.cts +15 -0
- package/dist/api/exchange/tokens-revoke.d.ts +15 -0
- package/dist/api/exchange/tokens-revoke.js +6 -0
- package/dist/api/info/account-by-l1-address.cjs +6 -0
- package/dist/api/info/account-by-l1-address.d.cts +28 -0
- package/dist/api/info/account-by-l1-address.d.ts +28 -0
- package/dist/api/info/account-by-l1-address.js +6 -0
- package/dist/api/info/account.cjs +6 -0
- package/dist/api/info/account.d.cts +67 -0
- package/dist/api/info/account.d.ts +67 -0
- package/dist/api/info/account.js +6 -0
- package/dist/api/info/announcement.cjs +6 -0
- package/dist/api/info/announcement.d.cts +15 -0
- package/dist/api/info/announcement.d.ts +15 -0
- package/dist/api/info/announcement.js +6 -0
- package/dist/api/info/api-keys.cjs +6 -0
- package/dist/api/info/api-keys.d.cts +19 -0
- package/dist/api/info/api-keys.d.ts +19 -0
- package/dist/api/info/api-keys.js +6 -0
- package/dist/api/info/asset-details.cjs +6 -0
- package/dist/api/info/asset-details.d.cts +26 -0
- package/dist/api/info/asset-details.d.ts +26 -0
- package/dist/api/info/asset-details.js +6 -0
- package/dist/api/info/candles.cjs +6 -0
- package/dist/api/info/candles.d.cts +23 -0
- package/dist/api/info/candles.d.ts +23 -0
- package/dist/api/info/candles.js +6 -0
- package/dist/api/info/exchange-stats.cjs +6 -0
- package/dist/api/info/exchange-stats.d.cts +11 -0
- package/dist/api/info/exchange-stats.d.ts +11 -0
- package/dist/api/info/exchange-stats.js +6 -0
- package/dist/api/info/fastbridge-info.cjs +6 -0
- package/dist/api/info/fastbridge-info.d.cts +10 -0
- package/dist/api/info/fastbridge-info.d.ts +10 -0
- package/dist/api/info/fastbridge-info.js +6 -0
- package/dist/api/info/funding-rates.cjs +6 -0
- package/dist/api/info/funding-rates.d.cts +16 -0
- package/dist/api/info/funding-rates.d.ts +16 -0
- package/dist/api/info/funding-rates.js +6 -0
- package/dist/api/info/fundings.cjs +6 -0
- package/dist/api/info/fundings.d.cts +21 -0
- package/dist/api/info/fundings.d.ts +21 -0
- package/dist/api/info/fundings.js +6 -0
- package/dist/api/info/index.cjs +85 -0
- package/dist/api/info/index.d.cts +22 -0
- package/dist/api/info/index.d.ts +22 -0
- package/dist/api/info/index.js +85 -0
- package/dist/api/info/next-nonce.cjs +6 -0
- package/dist/api/info/next-nonce.d.cts +14 -0
- package/dist/api/info/next-nonce.d.ts +14 -0
- package/dist/api/info/next-nonce.js +6 -0
- package/dist/api/info/order-book-details.cjs +8 -0
- package/dist/api/info/order-book-details.d.cts +95 -0
- package/dist/api/info/order-book-details.d.ts +95 -0
- package/dist/api/info/order-book-details.js +8 -0
- package/dist/api/info/order-books.cjs +6 -0
- package/dist/api/info/order-books.d.cts +16 -0
- package/dist/api/info/order-books.d.ts +16 -0
- package/dist/api/info/order-books.js +6 -0
- package/dist/api/info/recent-trades.cjs +6 -0
- package/dist/api/info/recent-trades.d.cts +11 -0
- package/dist/api/info/recent-trades.d.ts +11 -0
- package/dist/api/info/recent-trades.js +6 -0
- package/dist/api/info/root-info.cjs +6 -0
- package/dist/api/info/root-info.d.cts +8 -0
- package/dist/api/info/root-info.d.ts +8 -0
- package/dist/api/info/root-info.js +6 -0
- package/dist/api/info/root-status.cjs +6 -0
- package/dist/api/info/root-status.d.cts +10 -0
- package/dist/api/info/root-status.d.ts +10 -0
- package/dist/api/info/root-status.js +6 -0
- package/dist/api/info/tx-from-l1-hash.cjs +6 -0
- package/dist/api/info/tx-from-l1-hash.d.cts +9 -0
- package/dist/api/info/tx-from-l1-hash.d.ts +9 -0
- package/dist/api/info/tx-from-l1-hash.js +6 -0
- package/dist/api/info/tx.cjs +6 -0
- package/dist/api/info/tx.d.cts +33 -0
- package/dist/api/info/tx.d.ts +33 -0
- package/dist/api/info/tx.js +6 -0
- package/dist/api/info/txs.cjs +6 -0
- package/dist/api/info/txs.d.cts +11 -0
- package/dist/api/info/txs.d.ts +11 -0
- package/dist/api/info/txs.js +6 -0
- package/dist/api/info/withdrawal-delay.cjs +6 -0
- package/dist/api/info/withdrawal-delay.d.cts +8 -0
- package/dist/api/info/withdrawal-delay.d.ts +8 -0
- package/dist/api/info/withdrawal-delay.js +6 -0
- package/dist/api/info-private/account-active-orders.cjs +6 -0
- package/dist/api/info-private/account-active-orders.d.cts +11 -0
- package/dist/api/info-private/account-active-orders.d.ts +11 -0
- package/dist/api/info-private/account-active-orders.js +6 -0
- package/dist/api/info-private/account-inactive-orders.cjs +6 -0
- package/dist/api/info-private/account-inactive-orders.d.cts +52 -0
- package/dist/api/info-private/account-inactive-orders.d.ts +52 -0
- package/dist/api/info-private/account-inactive-orders.js +6 -0
- package/dist/api/info-private/account-limits.cjs +6 -0
- package/dist/api/info-private/account-limits.d.cts +16 -0
- package/dist/api/info-private/account-limits.d.ts +16 -0
- package/dist/api/info-private/account-limits.js +6 -0
- package/dist/api/info-private/account-metadata.cjs +6 -0
- package/dist/api/info-private/account-metadata.d.cts +22 -0
- package/dist/api/info-private/account-metadata.d.ts +22 -0
- package/dist/api/info-private/account-metadata.js +6 -0
- package/dist/api/info-private/deposit-history.cjs +6 -0
- package/dist/api/info-private/deposit-history.d.cts +27 -0
- package/dist/api/info-private/deposit-history.d.ts +27 -0
- package/dist/api/info-private/deposit-history.js +6 -0
- package/dist/api/info-private/export.cjs +6 -0
- package/dist/api/info-private/export.d.cts +16 -0
- package/dist/api/info-private/export.d.ts +16 -0
- package/dist/api/info-private/export.js +6 -0
- package/dist/api/info-private/fastwithdraw-info.cjs +6 -0
- package/dist/api/info-private/fastwithdraw-info.d.cts +16 -0
- package/dist/api/info-private/fastwithdraw-info.d.ts +16 -0
- package/dist/api/info-private/fastwithdraw-info.js +6 -0
- package/dist/api/info-private/index.cjs +75 -0
- package/dist/api/info-private/index.d.cts +19 -0
- package/dist/api/info-private/index.d.ts +19 -0
- package/dist/api/info-private/index.js +75 -0
- package/dist/api/info-private/l1-metadata.cjs +6 -0
- package/dist/api/info-private/l1-metadata.d.cts +16 -0
- package/dist/api/info-private/l1-metadata.d.ts +16 -0
- package/dist/api/info-private/l1-metadata.js +6 -0
- package/dist/api/info-private/liquidations.cjs +6 -0
- package/dist/api/info-private/liquidations.d.cts +66 -0
- package/dist/api/info-private/liquidations.d.ts +66 -0
- package/dist/api/info-private/liquidations.js +6 -0
- package/dist/api/info-private/pnl.cjs +6 -0
- package/dist/api/info-private/pnl.d.cts +24 -0
- package/dist/api/info-private/pnl.d.ts +24 -0
- package/dist/api/info-private/pnl.js +6 -0
- package/dist/api/info-private/position-funding.cjs +6 -0
- package/dist/api/info-private/position-funding.d.cts +28 -0
- package/dist/api/info-private/position-funding.d.ts +28 -0
- package/dist/api/info-private/position-funding.js +6 -0
- package/dist/api/info-private/public-pools-metadata.cjs +6 -0
- package/dist/api/info-private/public-pools-metadata.d.cts +24 -0
- package/dist/api/info-private/public-pools-metadata.d.ts +24 -0
- package/dist/api/info-private/public-pools-metadata.js +6 -0
- package/dist/api/info-private/referral-points.cjs +6 -0
- package/dist/api/info-private/referral-points.d.cts +24 -0
- package/dist/api/info-private/referral-points.d.ts +24 -0
- package/dist/api/info-private/referral-points.js +6 -0
- package/dist/api/info-private/tokens.cjs +6 -0
- package/dist/api/info-private/tokens.d.cts +24 -0
- package/dist/api/info-private/tokens.d.ts +24 -0
- package/dist/api/info-private/tokens.js +6 -0
- package/dist/api/info-private/trades.cjs +6 -0
- package/dist/api/info-private/trades.d.cts +49 -0
- package/dist/api/info-private/trades.d.ts +49 -0
- package/dist/api/info-private/trades.js +6 -0
- package/dist/api/info-private/transfer-fee-info.cjs +6 -0
- package/dist/api/info-private/transfer-fee-info.d.cts +15 -0
- package/dist/api/info-private/transfer-fee-info.d.ts +15 -0
- package/dist/api/info-private/transfer-fee-info.js +6 -0
- package/dist/api/info-private/transfer-history.cjs +6 -0
- package/dist/api/info-private/transfer-history.d.cts +27 -0
- package/dist/api/info-private/transfer-history.d.ts +27 -0
- package/dist/api/info-private/transfer-history.js +6 -0
- package/dist/api/info-private/withdraw-history.cjs +6 -0
- package/dist/api/info-private/withdraw-history.d.cts +27 -0
- package/dist/api/info-private/withdraw-history.d.ts +27 -0
- package/dist/api/info-private/withdraw-history.js +6 -0
- package/dist/chunk-2R5COGAH.cjs +10 -0
- package/dist/chunk-3OSXAPI3.js +8 -0
- package/dist/chunk-3R4OL3TU.cjs +17 -0
- package/dist/chunk-3SKO62BC.js +0 -0
- package/dist/chunk-3Y76Q54G.js +18 -0
- package/dist/chunk-3ZIFHX7Q.cjs +1 -0
- package/dist/chunk-467IJZRE.js +14 -0
- package/dist/chunk-472ULOSN.js +10 -0
- package/dist/chunk-4LNJ2577.js +17 -0
- package/dist/chunk-4MZ3XQUJ.cjs +13 -0
- package/dist/chunk-4TIJW7PH.cjs +14 -0
- package/dist/chunk-4VAZ7ZA2.js +10 -0
- package/dist/chunk-5JDRAN7L.cjs +22 -0
- package/dist/chunk-5P5CPB5A.js +18 -0
- package/dist/chunk-5U6X6DI7.cjs +13 -0
- package/dist/chunk-5WEMEUUI.js +22 -0
- package/dist/chunk-5YGIBBTZ.js +357 -0
- package/dist/chunk-62KDFQ7D.js +367 -0
- package/dist/chunk-6CD3YMMG.cjs +1 -0
- package/dist/chunk-6GCE6YQR.cjs +8 -0
- package/dist/chunk-6LUEPRL7.cjs +16 -0
- package/dist/chunk-76SPKVHT.js +48 -0
- package/dist/chunk-77QSYYAW.js +13 -0
- package/dist/chunk-7U2USLAM.cjs +8 -0
- package/dist/chunk-A2APDMN3.js +13 -0
- package/dist/chunk-AKEQDKGA.js +167 -0
- package/dist/chunk-AMNDQGYL.js +18 -0
- package/dist/chunk-BA2QFD27.cjs +19 -0
- package/dist/chunk-BES73YEF.js +8 -0
- package/dist/chunk-BKIL4UXV.cjs +22 -0
- package/dist/chunk-BKJGDTS3.js +8 -0
- package/dist/chunk-BVC2AA7Y.cjs +8 -0
- package/dist/chunk-BXMXWCMD.js +13 -0
- package/dist/chunk-C7OTZCGC.js +0 -0
- package/dist/chunk-DCKMNDS3.js +0 -0
- package/dist/chunk-DOZF64YC.cjs +17 -0
- package/dist/chunk-DW6W5SX2.cjs +18 -0
- package/dist/chunk-E3GJJZER.cjs +8 -0
- package/dist/chunk-EBSW5ZYW.js +19 -0
- package/dist/chunk-F24JA2OV.cjs +22 -0
- package/dist/chunk-FJJWUBKM.js +17 -0
- package/dist/chunk-FM4WWIRI.cjs +17 -0
- package/dist/chunk-FODEDUT4.js +8 -0
- package/dist/chunk-GEWTGUEG.cjs +1 -0
- package/dist/chunk-GI4WUHSL.cjs +1 -0
- package/dist/chunk-GYABNQWH.js +8 -0
- package/dist/chunk-GYQ6HJQY.cjs +21 -0
- package/dist/chunk-INCL3WRA.cjs +13 -0
- package/dist/chunk-IQQRFW4A.cjs +8 -0
- package/dist/chunk-IT6LK2G5.cjs +19 -0
- package/dist/chunk-IXF4QUC6.js +8 -0
- package/dist/chunk-J3UZK77O.cjs +18 -0
- package/dist/chunk-J7GXRK7R.cjs +19 -0
- package/dist/chunk-JNTYHWDJ.js +22 -0
- package/dist/chunk-JTE4UBAX.js +8 -0
- package/dist/chunk-JTP6DTDN.js +0 -0
- package/dist/chunk-K7ZQARON.js +8 -0
- package/dist/chunk-KV6G2ZCR.js +539 -0
- package/dist/chunk-L5SDFTHR.cjs +242 -0
- package/dist/chunk-LBVNEQ5R.cjs +21 -0
- package/dist/chunk-LYNZNSLV.js +18 -0
- package/dist/chunk-MAPH47LH.cjs +1 -0
- package/dist/chunk-MO4PMYTS.js +0 -0
- package/dist/chunk-MOMFTZ7N.cjs +357 -0
- package/dist/chunk-MZCKU6FF.js +8 -0
- package/dist/chunk-NIMYOIVU.cjs +1 -0
- package/dist/chunk-NIT6TCVS.cjs +8 -0
- package/dist/chunk-NOFXPTLU.js +8 -0
- package/dist/chunk-NRZGE42C.js +23 -0
- package/dist/chunk-NSFKW27X.js +0 -0
- package/dist/chunk-O3PA6HV2.js +18 -0
- package/dist/chunk-ON64OVOQ.cjs +20 -0
- package/dist/chunk-OPSCTD6W.js +17 -0
- package/dist/chunk-P32EPCEM.js +19 -0
- package/dist/chunk-PEALQBVN.js +19 -0
- package/dist/chunk-PP4Q2W66.cjs +10 -0
- package/dist/chunk-PPU2VWXX.js +12 -0
- package/dist/chunk-Q2MT7FZ7.js +242 -0
- package/dist/chunk-QCE5PEXE.cjs +8 -0
- package/dist/chunk-QMXZQNBK.cjs +8 -0
- package/dist/chunk-QNM3HYIV.cjs +8 -0
- package/dist/chunk-QXGO7TJ2.js +17 -0
- package/dist/chunk-RGVFMOQI.js +20 -0
- package/dist/chunk-RYDJEI67.cjs +48 -0
- package/dist/chunk-S4OE3IME.js +13 -0
- package/dist/chunk-SA6CXVP6.js +22 -0
- package/dist/chunk-SK6Y2YH6.js +0 -0
- package/dist/chunk-TELGVFFP.js +13 -0
- package/dist/chunk-TPGO4YD3.js +21 -0
- package/dist/chunk-TSHQJVUP.js +0 -0
- package/dist/chunk-TWGXKYO2.cjs +23 -0
- package/dist/chunk-U25GSCR7.cjs +17 -0
- package/dist/chunk-U2SM46CP.cjs +17 -0
- package/dist/chunk-UICTRTWB.cjs +367 -0
- package/dist/chunk-UORSMHI2.js +21 -0
- package/dist/chunk-VDBWTSBC.cjs +1 -0
- package/dist/chunk-VNQKWIQG.cjs +13 -0
- package/dist/chunk-VT3N7TOX.js +325 -0
- package/dist/chunk-VW77SNCY.js +24 -0
- package/dist/chunk-W2BVNVOC.cjs +1 -0
- package/dist/chunk-W2CTGWUW.cjs +539 -0
- package/dist/chunk-W5VY4TWP.js +16 -0
- package/dist/chunk-WDQ4YM6C.cjs +167 -0
- package/dist/chunk-WK6OQRMG.cjs +8 -0
- package/dist/chunk-WWLOQFSW.cjs +12 -0
- package/dist/chunk-X7E6XJVQ.cjs +18 -0
- package/dist/chunk-XOG6T533.cjs +18 -0
- package/dist/chunk-XPZBVL56.cjs +325 -0
- package/dist/chunk-XQGOXCT4.js +22 -0
- package/dist/chunk-YVJVFJ24.cjs +19 -0
- package/dist/chunk-YWN57BJF.js +8 -0
- package/dist/chunk-Z5XTWR2A.cjs +8 -0
- package/dist/chunk-ZDNQFOED.js +17 -0
- package/dist/chunk-ZGWYI7Q2.cjs +24 -0
- package/dist/chunk-ZIMFMYT2.cjs +22 -0
- package/dist/chunk-ZJVQD6JD.cjs +18 -0
- package/dist/chunk-ZKFXRN6W.cjs +13 -0
- package/dist/chunk-ZWYNOAL3.js +19 -0
- package/dist/client/exchange-client.cjs +14 -0
- package/dist/client/exchange-client.d.cts +352 -0
- package/dist/client/exchange-client.d.ts +352 -0
- package/dist/client/exchange-client.js +14 -0
- package/dist/client/index.cjs +71 -0
- package/dist/client/index.d.cts +53 -0
- package/dist/client/index.d.ts +53 -0
- package/dist/client/index.js +71 -0
- package/dist/client/info-client.cjs +27 -0
- package/dist/client/info-client.d.cts +255 -0
- package/dist/client/info-client.d.ts +255 -0
- package/dist/client/info-client.js +27 -0
- package/dist/client/info-private-client.cjs +25 -0
- package/dist/client/info-private-client.d.cts +293 -0
- package/dist/client/info-private-client.d.ts +293 -0
- package/dist/client/info-private-client.js +25 -0
- package/dist/client/l1-bridge-client.cjs +6 -0
- package/dist/client/l1-bridge-client.d.cts +45 -0
- package/dist/client/l1-bridge-client.d.ts +45 -0
- package/dist/client/l1-bridge-client.js +6 -0
- package/dist/client/ws-client.cjs +6 -0
- package/dist/client/ws-client.d.cts +63 -0
- package/dist/client/ws-client.d.ts +63 -0
- package/dist/client/ws-client.js +6 -0
- package/dist/index.cjs +79 -0
- package/dist/index.d.cts +53 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +79 -0
- package/dist/signing/index.cjs +7 -0
- package/dist/signing/index.d.cts +1 -0
- package/dist/signing/index.d.ts +1 -0
- package/dist/signing/index.js +7 -0
- package/dist/signing/wasm-signer.cjs +6 -0
- package/dist/signing/wasm-signer.d.cts +101 -0
- package/dist/signing/wasm-signer.d.ts +101 -0
- package/dist/signing/wasm-signer.js +6 -0
- package/dist/types/bridge.cjs +1 -0
- package/dist/types/bridge.d.cts +24 -0
- package/dist/types/bridge.d.ts +24 -0
- package/dist/types/bridge.js +1 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +3 -0
- package/dist/types/ws.cjs +1 -0
- package/dist/types/ws.d.cts +351 -0
- package/dist/types/ws.d.ts +351 -0
- package/dist/types/ws.js +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTrades
|
|
3
|
+
} from "./chunk-467IJZRE.js";
|
|
4
|
+
import {
|
|
5
|
+
getTransferFeeInfo
|
|
6
|
+
} from "./chunk-LYNZNSLV.js";
|
|
7
|
+
import {
|
|
8
|
+
getTransferHistory
|
|
9
|
+
} from "./chunk-3Y76Q54G.js";
|
|
10
|
+
import {
|
|
11
|
+
getWithdrawHistory
|
|
12
|
+
} from "./chunk-PEALQBVN.js";
|
|
13
|
+
import {
|
|
14
|
+
getL1Metadata
|
|
15
|
+
} from "./chunk-QXGO7TJ2.js";
|
|
16
|
+
import {
|
|
17
|
+
getLiquidations
|
|
18
|
+
} from "./chunk-RGVFMOQI.js";
|
|
19
|
+
import {
|
|
20
|
+
getPnL
|
|
21
|
+
} from "./chunk-NRZGE42C.js";
|
|
22
|
+
import {
|
|
23
|
+
getPositionFunding
|
|
24
|
+
} from "./chunk-TPGO4YD3.js";
|
|
25
|
+
import {
|
|
26
|
+
getPublicPools
|
|
27
|
+
} from "./chunk-O3PA6HV2.js";
|
|
28
|
+
import {
|
|
29
|
+
getReferralPoints
|
|
30
|
+
} from "./chunk-W5VY4TWP.js";
|
|
31
|
+
import {
|
|
32
|
+
getTokens
|
|
33
|
+
} from "./chunk-OPSCTD6W.js";
|
|
34
|
+
import {
|
|
35
|
+
getAccountActiveOrders
|
|
36
|
+
} from "./chunk-AMNDQGYL.js";
|
|
37
|
+
import {
|
|
38
|
+
getAccountInactiveOrders
|
|
39
|
+
} from "./chunk-XQGOXCT4.js";
|
|
40
|
+
import {
|
|
41
|
+
getAccountLimits
|
|
42
|
+
} from "./chunk-4LNJ2577.js";
|
|
43
|
+
import {
|
|
44
|
+
getAccountMetadata
|
|
45
|
+
} from "./chunk-5P5CPB5A.js";
|
|
46
|
+
import {
|
|
47
|
+
getDepositHistory
|
|
48
|
+
} from "./chunk-P32EPCEM.js";
|
|
49
|
+
import {
|
|
50
|
+
getExport
|
|
51
|
+
} from "./chunk-EBSW5ZYW.js";
|
|
52
|
+
import {
|
|
53
|
+
getFastWithdrawInfo
|
|
54
|
+
} from "./chunk-ZDNQFOED.js";
|
|
55
|
+
|
|
56
|
+
// src/client/info-private-client.ts
|
|
57
|
+
import axios from "axios";
|
|
58
|
+
var DEFAULT_DEADLINE = 120;
|
|
59
|
+
var InfoPrivateClient = class {
|
|
60
|
+
constructor(config) {
|
|
61
|
+
this.baseURL = config.baseURL || "https://mainnet.zklighter.elliot.ai";
|
|
62
|
+
this.wasmSigner = config.wasmSigner;
|
|
63
|
+
this.axiosInstance = this.createAxiosInstance();
|
|
64
|
+
}
|
|
65
|
+
createAxiosInstance() {
|
|
66
|
+
return axios.create({
|
|
67
|
+
baseURL: this.baseURL
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get active orders for an account in a specific market
|
|
72
|
+
* @param params - Account index and market ID to retrieve active orders for
|
|
73
|
+
* @returns List of active orders
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const orders = await client.getAccountActiveOrders({
|
|
77
|
+
* account_index: 0,
|
|
78
|
+
* market_id: 1
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
async getAccountActiveOrders(params) {
|
|
83
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
84
|
+
return getAccountActiveOrders(this.axiosInstance, params, auth.authToken);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get inactive orders for an account
|
|
88
|
+
* @param params - Account index and optional filters for inactive orders
|
|
89
|
+
* @returns List of inactive orders with pagination support
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const orders = await client.getAccountInactiveOrders({
|
|
93
|
+
* account_index: 0,
|
|
94
|
+
* limit: 50,
|
|
95
|
+
* market_id: 1
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async getAccountInactiveOrders(params) {
|
|
100
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
101
|
+
return getAccountInactiveOrders(this.axiosInstance, params, auth.authToken);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get account limits and tier information
|
|
105
|
+
* @param params - Account index to retrieve limits for
|
|
106
|
+
* @returns Account limits including max LLP percentage, user tier, and pool creation permissions
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const limits = await client.getAccountLimits({ account_index: 0 });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
async getAccountLimits(params) {
|
|
113
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
114
|
+
return getAccountLimits(this.axiosInstance, params, auth.authToken);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get account metadata by index or L1 address
|
|
118
|
+
* @param params - Account lookup parameters (by index or L1 address)
|
|
119
|
+
* @returns Account metadata including name, description, and referral information
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const metadata = await client.getAccountMetadata({
|
|
123
|
+
* by: "index",
|
|
124
|
+
* value: "0"
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
async getAccountMetadata(params) {
|
|
129
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
130
|
+
return getAccountMetadata(this.axiosInstance, params, auth.authToken);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get L1 metadata for an address
|
|
134
|
+
* @param params - L1 address to retrieve metadata for
|
|
135
|
+
* @returns L1 metadata including referral information
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const l1Metadata = await client.getL1Metadata({
|
|
139
|
+
* l1_address: "0x..."
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
async getL1Metadata(params) {
|
|
144
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
145
|
+
return getL1Metadata(this.axiosInstance, params, auth.authToken);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get API tokens for an account
|
|
149
|
+
* @param params - Account index to retrieve API tokens for
|
|
150
|
+
* @returns List of API tokens with details including name, expiry, scopes, and status
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const tokens = await client.getTokens({ account_index: 0 });
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
async getTokens(params) {
|
|
157
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
158
|
+
return getTokens(this.axiosInstance, params, auth.authToken);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get deposit history for an account
|
|
162
|
+
* @param params - Account index, L1 address, and optional filters
|
|
163
|
+
* @returns List of deposits with status and timestamps
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const deposits = await client.getDepositHistory({
|
|
167
|
+
* account_index: 0,
|
|
168
|
+
* l1_address: "0x...",
|
|
169
|
+
* filter: "pending"
|
|
170
|
+
* });
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
async getDepositHistory(params) {
|
|
174
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
175
|
+
return getDepositHistory(this.axiosInstance, params, auth.authToken);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get withdrawal history for an account
|
|
179
|
+
* @param params - Account index, L1 address, and optional filters
|
|
180
|
+
* @returns List of withdrawals with status and timestamps
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* const withdrawals = await client.getWithdrawHistory({
|
|
184
|
+
* account_index: 0,
|
|
185
|
+
* l1_address: "0x...",
|
|
186
|
+
* filter: "completed"
|
|
187
|
+
* });
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
async getWithdrawHistory(params) {
|
|
191
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
192
|
+
return getWithdrawHistory(this.axiosInstance, params, auth.authToken);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get fast withdraw information for an account
|
|
196
|
+
* @param params - Account index to retrieve fast withdraw info for
|
|
197
|
+
* @returns Fast withdraw limits and account information
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* const fastWithdrawInfo = await client.getFastWithdrawInfo({
|
|
201
|
+
* account_index: 0
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
async getFastWithdrawInfo(params) {
|
|
206
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
207
|
+
return getFastWithdrawInfo(this.axiosInstance, params, auth.authToken);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get transfer fee information between accounts
|
|
211
|
+
* @param params - Account indices to calculate transfer fee for
|
|
212
|
+
* @returns Transfer fee in USDC
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const feeInfo = await client.getTransferFeeInfo({
|
|
216
|
+
* account_index: 0,
|
|
217
|
+
* to_account_index: 1
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
async getTransferFeeInfo(params) {
|
|
222
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
223
|
+
return getTransferFeeInfo(this.axiosInstance, params, auth.authToken);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get transfer history for an account
|
|
227
|
+
* @param params - Account index and optional cursor for pagination
|
|
228
|
+
* @returns Transfer history with pagination support
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* const transfers = await client.getTransferHistory({
|
|
232
|
+
* account_index: 0,
|
|
233
|
+
* cursor: 'optional-cursor-for-pagination'
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
async getTransferHistory(params) {
|
|
238
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
239
|
+
return getTransferHistory(this.axiosInstance, params, auth.authToken);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get liquidation history for an account
|
|
243
|
+
* @param params - Account index, limit, and optional market/cursor filters
|
|
244
|
+
* @returns List of liquidations with pagination support
|
|
245
|
+
* @example
|
|
246
|
+
* ```typescript
|
|
247
|
+
* const liquidations = await client.getLiquidations({
|
|
248
|
+
* account_index: 0,
|
|
249
|
+
* limit: 50,
|
|
250
|
+
* market_id: 1
|
|
251
|
+
* });
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
async getLiquidations(params) {
|
|
255
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
256
|
+
return getLiquidations(this.axiosInstance, params, auth.authToken);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Get profit and loss data for an account or market
|
|
260
|
+
* @param params - PnL query parameters including resolution, time range, and account/market filters
|
|
261
|
+
* @returns PnL entries with timestamp, pnl, and cumulative pnl
|
|
262
|
+
* @example
|
|
263
|
+
* ```typescript
|
|
264
|
+
* const pnl = await client.getPnL({
|
|
265
|
+
* by: "account_index",
|
|
266
|
+
* value: "0",
|
|
267
|
+
* resolution: "1d",
|
|
268
|
+
* start_timestamp: 1234567890,
|
|
269
|
+
* end_timestamp: 1234567900,
|
|
270
|
+
* count_back: 30
|
|
271
|
+
* });
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
async getPnL(params) {
|
|
275
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
276
|
+
return getPnL(this.axiosInstance, params, auth.authToken);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get position funding history for an account
|
|
280
|
+
* @param params - Position funding query parameters including account_index, limit, and optional filters
|
|
281
|
+
* @returns Position funding entries with timestamp, funding rate, and position details
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* const funding = await client.getPositionFunding({
|
|
285
|
+
* account_index: 0,
|
|
286
|
+
* limit: 50,
|
|
287
|
+
* market_id: 1,
|
|
288
|
+
* side: "long"
|
|
289
|
+
* });
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
async getPositionFunding(params) {
|
|
293
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
294
|
+
return getPositionFunding(this.axiosInstance, params, auth.authToken);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Get public liquidity pools metadata
|
|
298
|
+
* @param params - Optional filters for pool queries (filter, limit, index)
|
|
299
|
+
* @returns List of public pools with TVL, APY, and share information
|
|
300
|
+
* @example
|
|
301
|
+
* ```typescript
|
|
302
|
+
* const pools = await client.getPublicPools({
|
|
303
|
+
* filter: "all",
|
|
304
|
+
* limit: 10,
|
|
305
|
+
* index: 0
|
|
306
|
+
* });
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
async getPublicPools(params) {
|
|
310
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
311
|
+
return getPublicPools(this.axiosInstance, params, auth.authToken);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Get referral points for an account
|
|
315
|
+
* @param params - Account index to retrieve referral points for
|
|
316
|
+
* @returns Referral points data including user points and referral list
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* const points = await client.getReferralPoints({ account_index: 0 });
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
async getReferralPoints(params) {
|
|
323
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
324
|
+
return getReferralPoints(this.axiosInstance, params, auth.authToken);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Get trades for an account or market
|
|
328
|
+
* @param params - Trade query parameters including sort_by, limit, and optional filters
|
|
329
|
+
* @returns List of trades with details including price, size, side, and timestamps
|
|
330
|
+
* @example
|
|
331
|
+
* ```typescript
|
|
332
|
+
* const trades = await client.getTrades({
|
|
333
|
+
* sort_by: 'timestamp',
|
|
334
|
+
* limit: 50,
|
|
335
|
+
* account_index: 0,
|
|
336
|
+
* market_id: 1,
|
|
337
|
+
* sort_dir: 'desc'
|
|
338
|
+
* });
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
async getTrades(params) {
|
|
342
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
343
|
+
return getTrades(this.axiosInstance, params, auth.authToken);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Export data (funding or trade data) for an account
|
|
347
|
+
* @param params - Export parameters including type (funding or trade) and optional filters
|
|
348
|
+
* @returns Export response with data URL for downloading the export
|
|
349
|
+
* @example
|
|
350
|
+
* ```typescript
|
|
351
|
+
* const exportData = await client.getExport({
|
|
352
|
+
* type: 'trade',
|
|
353
|
+
* account_index: 0,
|
|
354
|
+
* market_id: 1
|
|
355
|
+
* });
|
|
356
|
+
* console.log('Download URL:', exportData.data_url);
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
async getExport(params) {
|
|
360
|
+
const auth = this.wasmSigner.createAuthToken(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE);
|
|
361
|
+
return getExport(this.axiosInstance, params, auth.authToken);
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
export {
|
|
366
|
+
InfoPrivateClient
|
|
367
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/info/exchange-stats.ts
|
|
2
|
+
async function getExchangeStats(client) {
|
|
3
|
+
return client.get("/api/v1/exchangeStats").then((response) => response.data);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.getExchangeStats = getExchangeStats;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/info-private/referral-points.ts
|
|
2
|
+
async function getReferralPoints(client, params, authorization) {
|
|
3
|
+
const config = {
|
|
4
|
+
params: {
|
|
5
|
+
account_index: params.account_index
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
if (authorization) {
|
|
9
|
+
config.headers = { Authorization: authorization };
|
|
10
|
+
}
|
|
11
|
+
return client.get("/api/v1/referral/points", config).then((response) => response.data);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.getReferralPoints = getReferralPoints;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/api/exchange/send-tx.ts
|
|
2
|
+
async function sendTransaction(client, params) {
|
|
3
|
+
return client.post("/api/v1/sendTx", {
|
|
4
|
+
account_index: params.account_index,
|
|
5
|
+
api_key_index: params.api_key_index,
|
|
6
|
+
transaction: params.transaction,
|
|
7
|
+
...params.price_protection !== void 0 ? { price_protection: params.price_protection } : {}
|
|
8
|
+
}).then((response) => response.data);
|
|
9
|
+
}
|
|
10
|
+
async function sendTx(client, params) {
|
|
11
|
+
const urlParams = new URLSearchParams();
|
|
12
|
+
urlParams.append("tx_type", params.tx_type.toString());
|
|
13
|
+
urlParams.append("tx_info", params.tx_info);
|
|
14
|
+
urlParams.append("price_protection", params.price_protection !== false ? "true" : "false");
|
|
15
|
+
return client.post("/api/v1/sendTx", urlParams, {
|
|
16
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
17
|
+
}).then((response) => response.data);
|
|
18
|
+
}
|
|
19
|
+
async function sendTxWithIndices(client, params) {
|
|
20
|
+
const urlParams = new URLSearchParams();
|
|
21
|
+
urlParams.append("tx_type", params.tx_type.toString());
|
|
22
|
+
urlParams.append("tx_info", params.tx_info);
|
|
23
|
+
urlParams.append("account_index", params.account_index.toString());
|
|
24
|
+
urlParams.append("api_key_index", params.api_key_index.toString());
|
|
25
|
+
urlParams.append("price_protection", params.price_protection !== false ? "true" : "false");
|
|
26
|
+
return client.post("/api/v1/sendTx", urlParams, {
|
|
27
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
28
|
+
}).then((response) => response.data);
|
|
29
|
+
}
|
|
30
|
+
async function sendTxJson(client, params) {
|
|
31
|
+
const payload = {
|
|
32
|
+
tx_type: params.tx_type,
|
|
33
|
+
tx_info: params.tx_info,
|
|
34
|
+
account_index: params.account_index,
|
|
35
|
+
api_key_index: params.api_key_index,
|
|
36
|
+
price_protection: params.price_protection !== false
|
|
37
|
+
};
|
|
38
|
+
return client.post("/api/v1/sendTx", payload, {
|
|
39
|
+
headers: { "Content-Type": "application/json" }
|
|
40
|
+
}).then((response) => response.data);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
sendTransaction,
|
|
45
|
+
sendTx,
|
|
46
|
+
sendTxWithIndices,
|
|
47
|
+
sendTxJson
|
|
48
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/api/info/next-nonce.ts
|
|
2
|
+
async function getNextNonce(client, params) {
|
|
3
|
+
return client.get("/api/v1/nextNonce", {
|
|
4
|
+
params: {
|
|
5
|
+
account_index: params.account_index,
|
|
6
|
+
api_key_index: params.api_key_index
|
|
7
|
+
}
|
|
8
|
+
}).then((response) => response.data);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
getNextNonce
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/info/txs.ts
|
|
2
|
+
async function getTransactions(client, params) {
|
|
3
|
+
return client.get("/api/v1/txs", { params }).then((response) => response.data);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.getTransactions = getTransactions;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/api/info/asset-details.ts
|
|
2
|
+
async function getAssetDetails(client, params) {
|
|
3
|
+
const config = {
|
|
4
|
+
params: {
|
|
5
|
+
...params?.asset_index !== void 0 ? { asset_index: params.asset_index } : {}
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
return client.get("/api/v1/assetDetails", config).then((response) => response.data);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
getAssetDetails
|
|
13
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// src/signing/wasm-signer.ts
|
|
2
|
+
var WasmSigner = class {
|
|
3
|
+
constructor(config) {
|
|
4
|
+
this.apiKeyIndex = 0;
|
|
5
|
+
this.accountIndex = 0;
|
|
6
|
+
this.privateKey = "";
|
|
7
|
+
this.url = config?.url || "https://mainnet.zklighter.elliot.ai";
|
|
8
|
+
this.chainId = config?.chainId || 304;
|
|
9
|
+
this.wasmPath = config?.wasmPath || "/wasm/lighter-signer.wasm";
|
|
10
|
+
this.wasmExecPath = config?.wasmExecPath || "/wasm/lighter-wasm-exec.js";
|
|
11
|
+
}
|
|
12
|
+
async initialize() {
|
|
13
|
+
await this.loadScript(this.wasmExecPath);
|
|
14
|
+
const wasmBytes = await this.loadWasm(this.wasmPath);
|
|
15
|
+
const Go = window.Go;
|
|
16
|
+
const go = new Go();
|
|
17
|
+
const result = await WebAssembly.instantiate(wasmBytes, go.importObject);
|
|
18
|
+
go.run(result.instance);
|
|
19
|
+
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
20
|
+
}
|
|
21
|
+
generateAPIKey(seed) {
|
|
22
|
+
if (!window.GenerateAPIKey) {
|
|
23
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
24
|
+
}
|
|
25
|
+
return window.GenerateAPIKey(seed);
|
|
26
|
+
}
|
|
27
|
+
setAccount(privateKey, apiKeyIndex, accountIndex) {
|
|
28
|
+
this.privateKey = privateKey;
|
|
29
|
+
this.apiKeyIndex = apiKeyIndex;
|
|
30
|
+
this.accountIndex = accountIndex;
|
|
31
|
+
}
|
|
32
|
+
getAccount() {
|
|
33
|
+
return {
|
|
34
|
+
privateKey: this.privateKey,
|
|
35
|
+
apiKeyIndex: this.apiKeyIndex,
|
|
36
|
+
accountIndex: this.accountIndex
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
createClient() {
|
|
40
|
+
if (!window.CreateClient) {
|
|
41
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
42
|
+
}
|
|
43
|
+
return window.CreateClient(this.url, this.privateKey, this.chainId, this.apiKeyIndex, this.accountIndex);
|
|
44
|
+
}
|
|
45
|
+
checkClient() {
|
|
46
|
+
if (!window.CheckClient) {
|
|
47
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
48
|
+
}
|
|
49
|
+
return window.CheckClient(this.apiKeyIndex, this.accountIndex);
|
|
50
|
+
}
|
|
51
|
+
createAuthToken(deadline) {
|
|
52
|
+
if (!window.CreateAuthToken) {
|
|
53
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
54
|
+
}
|
|
55
|
+
return window.CreateAuthToken(deadline, this.apiKeyIndex, this.accountIndex);
|
|
56
|
+
}
|
|
57
|
+
signChangePubKey(pubKeyHex, nonce) {
|
|
58
|
+
if (!window.SignChangePubKey) {
|
|
59
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
60
|
+
}
|
|
61
|
+
return window.SignChangePubKey(pubKeyHex, nonce, this.apiKeyIndex, this.accountIndex);
|
|
62
|
+
}
|
|
63
|
+
signCreateOrder(marketIndex, clientOrderIndex, baseAmount, price, isAsk, orderType, timeInForce, reduceOnly, triggerPrice, orderExpiry, nonce) {
|
|
64
|
+
if (!window.SignCreateOrder) {
|
|
65
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
66
|
+
}
|
|
67
|
+
return window.SignCreateOrder(marketIndex, clientOrderIndex, baseAmount, price, isAsk, orderType, timeInForce, reduceOnly, triggerPrice, orderExpiry, nonce, this.apiKeyIndex, this.accountIndex);
|
|
68
|
+
}
|
|
69
|
+
signCancelOrder(marketIndex, orderIndex, nonce) {
|
|
70
|
+
if (!window.SignCancelOrder) {
|
|
71
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
72
|
+
}
|
|
73
|
+
return window.SignCancelOrder(marketIndex, orderIndex, nonce, this.apiKeyIndex, this.accountIndex);
|
|
74
|
+
}
|
|
75
|
+
signCancelAllOrders(timeInForce, time, nonce) {
|
|
76
|
+
if (!window.SignCancelAllOrders) {
|
|
77
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
78
|
+
}
|
|
79
|
+
return window.SignCancelAllOrders(timeInForce, time, nonce, this.apiKeyIndex, this.accountIndex);
|
|
80
|
+
}
|
|
81
|
+
signTransfer(toAccount, usdcAmount, fee, memo, nonce) {
|
|
82
|
+
if (!window.SignTransfer) {
|
|
83
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
84
|
+
}
|
|
85
|
+
return window.SignTransfer(toAccount, usdcAmount, fee, memo, nonce, this.apiKeyIndex, this.accountIndex);
|
|
86
|
+
}
|
|
87
|
+
signWithdraw(usdcAmount, nonce) {
|
|
88
|
+
if (!window.SignWithdraw) {
|
|
89
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
90
|
+
}
|
|
91
|
+
return window.SignWithdraw(usdcAmount, nonce, this.apiKeyIndex, this.accountIndex);
|
|
92
|
+
}
|
|
93
|
+
signUpdateLeverage(marketIndex, fraction, marginMode, nonce) {
|
|
94
|
+
if (!window.SignUpdateLeverage) {
|
|
95
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
96
|
+
}
|
|
97
|
+
return window.SignUpdateLeverage(marketIndex, fraction, marginMode, nonce, this.apiKeyIndex, this.accountIndex);
|
|
98
|
+
}
|
|
99
|
+
signModifyOrder(marketIndex, index, baseAmount, price, triggerPrice, nonce) {
|
|
100
|
+
if (!window.SignModifyOrder) {
|
|
101
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
102
|
+
}
|
|
103
|
+
return window.SignModifyOrder(marketIndex, index, baseAmount, price, triggerPrice, nonce, this.apiKeyIndex, this.accountIndex);
|
|
104
|
+
}
|
|
105
|
+
signCreateSubAccount(nonce) {
|
|
106
|
+
if (!window.SignCreateSubAccount) {
|
|
107
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
108
|
+
}
|
|
109
|
+
return window.SignCreateSubAccount(nonce, this.apiKeyIndex, this.accountIndex);
|
|
110
|
+
}
|
|
111
|
+
signCreatePublicPool(operatorFee, initialTotalShares, minOperatorShareRate, nonce) {
|
|
112
|
+
if (!window.SignCreatePublicPool) {
|
|
113
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
114
|
+
}
|
|
115
|
+
return window.SignCreatePublicPool(operatorFee, initialTotalShares, minOperatorShareRate, nonce, this.apiKeyIndex, this.accountIndex);
|
|
116
|
+
}
|
|
117
|
+
signUpdatePublicPool(publicPoolIndex, status, operatorFee, minOperatorShareRate, nonce) {
|
|
118
|
+
if (!window.SignUpdatePublicPool) {
|
|
119
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
120
|
+
}
|
|
121
|
+
return window.SignUpdatePublicPool(publicPoolIndex, status, operatorFee, minOperatorShareRate, nonce, this.apiKeyIndex, this.accountIndex);
|
|
122
|
+
}
|
|
123
|
+
signMintShares(publicPoolIndex, shareAmount, nonce) {
|
|
124
|
+
if (!window.SignMintShares) {
|
|
125
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
126
|
+
}
|
|
127
|
+
return window.SignMintShares(publicPoolIndex, shareAmount, nonce, this.apiKeyIndex, this.accountIndex);
|
|
128
|
+
}
|
|
129
|
+
signBurnShares(publicPoolIndex, shareAmount, nonce) {
|
|
130
|
+
if (!window.SignBurnShares) {
|
|
131
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
132
|
+
}
|
|
133
|
+
return window.SignBurnShares(publicPoolIndex, shareAmount, nonce, this.apiKeyIndex, this.accountIndex);
|
|
134
|
+
}
|
|
135
|
+
signUpdateMargin(marketIndex, usdcAmount, direction, nonce) {
|
|
136
|
+
if (!window.SignUpdateMargin) {
|
|
137
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
138
|
+
}
|
|
139
|
+
return window.SignUpdateMargin(marketIndex, usdcAmount, direction, nonce, this.apiKeyIndex, this.accountIndex);
|
|
140
|
+
}
|
|
141
|
+
signCreateGroupedOrders(groupingType, orders, nonce) {
|
|
142
|
+
if (!window.SignCreateGroupedOrders) {
|
|
143
|
+
throw new Error("WASM not initialized. Call initialize() first.");
|
|
144
|
+
}
|
|
145
|
+
return window.SignCreateGroupedOrders(groupingType, orders, nonce, this.apiKeyIndex, this.accountIndex);
|
|
146
|
+
}
|
|
147
|
+
async loadScript(src) {
|
|
148
|
+
return new Promise((resolve, reject) => {
|
|
149
|
+
const script = document.createElement("script");
|
|
150
|
+
script.src = src;
|
|
151
|
+
script.onload = () => resolve();
|
|
152
|
+
script.onerror = () => reject(new Error(`Failed to load script: ${src}`));
|
|
153
|
+
document.head.appendChild(script);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
async loadWasm(path) {
|
|
157
|
+
const response = await fetch(path);
|
|
158
|
+
if (!response.ok) {
|
|
159
|
+
throw new Error(`Failed to load WASM binary: ${response.statusText}`);
|
|
160
|
+
}
|
|
161
|
+
return response.arrayBuffer();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
WasmSigner
|
|
167
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/api/info-private/account-active-orders.ts
|
|
2
|
+
async function getAccountActiveOrders(client, params, authorization) {
|
|
3
|
+
const config = {
|
|
4
|
+
params: {
|
|
5
|
+
account_index: params.account_index,
|
|
6
|
+
market_id: params.market_id,
|
|
7
|
+
...params.auth ? { auth: params.auth } : {}
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
if (authorization) {
|
|
11
|
+
config.headers = { Authorization: authorization };
|
|
12
|
+
}
|
|
13
|
+
return client.get("/api/v1/accountActiveOrders", config).then((response) => response.data);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
getAccountActiveOrders
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/api/info/order-book-details.ts
|
|
2
|
+
async function getOrderBookDetails(client, params) {
|
|
3
|
+
return client.get("/api/v1/orderBookDetails", {
|
|
4
|
+
params: _optionalChain([params, 'optionalAccess', _ => _.market_id]) !== void 0 ? { market_id: params.market_id } : void 0
|
|
5
|
+
}).then((response) => response.data);
|
|
6
|
+
}
|
|
7
|
+
async function getOrderBookOrders(client, params) {
|
|
8
|
+
return client.get("/api/v1/orderBookOrders", {
|
|
9
|
+
params: {
|
|
10
|
+
market_id: params.market_id,
|
|
11
|
+
...params.limit !== void 0 ? { limit: params.limit } : {}
|
|
12
|
+
}
|
|
13
|
+
}).then((response) => response.data);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.getOrderBookDetails = getOrderBookDetails; exports.getOrderBookOrders = getOrderBookOrders;
|