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,167 @@
|
|
|
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/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 = _optionalChain([config, 'optionalAccess', _ => _.url]) || "https://mainnet.zklighter.elliot.ai";
|
|
8
|
+
this.chainId = _optionalChain([config, 'optionalAccess', _2 => _2.chainId]) || 304;
|
|
9
|
+
this.wasmPath = _optionalChain([config, 'optionalAccess', _3 => _3.wasmPath]) || "/wasm/lighter-signer.wasm";
|
|
10
|
+
this.wasmExecPath = _optionalChain([config, 'optionalAccess', _4 => _4.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
|
+
|
|
166
|
+
|
|
167
|
+
exports.WasmSigner = WasmSigner;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/info/order-books.ts
|
|
2
|
+
async function getOrderBooks(client) {
|
|
3
|
+
return client.get("/api/v1/orderBooks").then((response) => response.data);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.getOrderBooks = getOrderBooks;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/info/tx-from-l1-hash.ts
|
|
2
|
+
async function getTransactionFromL1TxHash(client, params) {
|
|
3
|
+
return client.get("/api/v1/txFromL1TxHash", {
|
|
4
|
+
params: {
|
|
5
|
+
l1_tx_hash: params.l1_tx_hash
|
|
6
|
+
}
|
|
7
|
+
}).then((response) => response.data);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.getTransactionFromL1TxHash = getTransactionFromL1TxHash;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/api/info-private/public-pools-metadata.ts
|
|
2
|
+
async function getPublicPools(client, params = {}, authorization) {
|
|
3
|
+
const config = {
|
|
4
|
+
params: {
|
|
5
|
+
filter: _nullishCoalesce(params.filter, () => ( "all")),
|
|
6
|
+
limit: _nullishCoalesce(params.limit, () => ( 10)),
|
|
7
|
+
index: _nullishCoalesce(params.index, () => ( 0))
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
if (authorization) {
|
|
11
|
+
config.headers = { Authorization: authorization };
|
|
12
|
+
}
|
|
13
|
+
return client.get("/api/v1/publicPools", config).then((response) => response.data);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.getPublicPools = getPublicPools;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// 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
|
+
|
|
17
|
+
|
|
18
|
+
exports.getAccountActiveOrders = getAccountActiveOrders;
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }
|
|
2
|
+
|
|
3
|
+
var _chunkQCE5PEXEcjs = require('./chunk-QCE5PEXE.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkBA2QFD27cjs = require('./chunk-BA2QFD27.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkWK6OQRMGcjs = require('./chunk-WK6OQRMG.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkZKFXRN6Wcjs = require('./chunk-ZKFXRN6W.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkIQQRFW4Acjs = require('./chunk-IQQRFW4A.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkWWLOQFSWcjs = require('./chunk-WWLOQFSW.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkVNQKWIQGcjs = require('./chunk-VNQKWIQG.cjs');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunk7U2USLAMcjs = require('./chunk-7U2USLAM.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _chunk5U6X6DI7cjs = require('./chunk-5U6X6DI7.cjs');
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunkNIT6TCVScjs = require('./chunk-NIT6TCVS.cjs');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunk6GCE6YQRcjs = require('./chunk-6GCE6YQR.cjs');
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var _chunkBVC2AA7Ycjs = require('./chunk-BVC2AA7Y.cjs');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _chunkZ5XTWR2Acjs = require('./chunk-Z5XTWR2A.cjs');
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
var _chunkQMXZQNBKcjs = require('./chunk-QMXZQNBK.cjs');
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
var _chunk4MZ3XQUJcjs = require('./chunk-4MZ3XQUJ.cjs');
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
var _chunk2R5COGAHcjs = require('./chunk-2R5COGAH.cjs');
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var _chunkPP4Q2W66cjs = require('./chunk-PP4Q2W66.cjs');
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
var _chunkE3GJJZERcjs = require('./chunk-E3GJJZER.cjs');
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
var _chunkINCL3WRAcjs = require('./chunk-INCL3WRA.cjs');
|
|
59
|
+
|
|
60
|
+
// src/client/info-client.ts
|
|
61
|
+
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
62
|
+
var InfoClient = class {
|
|
63
|
+
constructor(config) {
|
|
64
|
+
this.config = {
|
|
65
|
+
baseURL: _optionalChain([config, 'optionalAccess', _ => _.baseURL]) || "https://mainnet.zklighter.elliot.ai"
|
|
66
|
+
};
|
|
67
|
+
this.axiosInstance = this.createAxiosInstance();
|
|
68
|
+
}
|
|
69
|
+
createAxiosInstance() {
|
|
70
|
+
return _axios2.default.create({
|
|
71
|
+
baseURL: this.config.baseURL
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get account information by index or L2 address
|
|
76
|
+
* @param params - Account lookup parameters (by index or L2 address)
|
|
77
|
+
* @returns Account information including balances and positions
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const account = await client.getAccountInfo({ by: "index", value: "0" });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
async getAccountInfo(params) {
|
|
84
|
+
return _chunkPP4Q2W66cjs.getAccountInfo.call(void 0, this.axiosInstance, params);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get account information by L1 address
|
|
88
|
+
* @param params - L1 address lookup parameters
|
|
89
|
+
* @returns Account information associated with the L1 address
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const account = await client.getAccountByL1Address({ l1_address: "0x..." });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
async getAccountByL1Address(params) {
|
|
96
|
+
return _chunk2R5COGAHcjs.getAccountByL1Address.call(void 0, this.axiosInstance, params);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get API keys for an account
|
|
100
|
+
* @param params - Account index to retrieve API keys for
|
|
101
|
+
* @returns List of API keys associated with the account
|
|
102
|
+
* @example
|
|
103
|
+
* ```typeScript
|
|
104
|
+
* const keys = await client.getApiKeys({ account_index: 0 });
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
async getApiKeys(params) {
|
|
108
|
+
return _chunkINCL3WRAcjs.getApiKeys.call(void 0, this.axiosInstance, params);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get system announcements
|
|
112
|
+
* @returns List of active announcements
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const announcements = await client.getAnnouncements();
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
async getAnnouncements() {
|
|
119
|
+
return _chunkE3GJJZERcjs.getAnnouncements.call(void 0, this.axiosInstance);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get asset details for a specific asset or all assets
|
|
123
|
+
* @param params - Optional asset_index to get details for a specific asset
|
|
124
|
+
* @returns Asset details including symbol, decimals, limits, and pricing information
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* // Get all assets
|
|
128
|
+
* const allAssets = await client.getAssetDetails();
|
|
129
|
+
*
|
|
130
|
+
* // Get specific asset
|
|
131
|
+
* const asset = await client.getAssetDetails({ asset_index: 0 });
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
async getAssetDetails(params) {
|
|
135
|
+
return _chunk5U6X6DI7cjs.getAssetDetails.call(void 0, this.axiosInstance, params);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get candlestick data for a market
|
|
139
|
+
* @param params - Candlestick query parameters including market_id, resolution, and time range
|
|
140
|
+
* @returns Array of candlestick data
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const candles = await client.getCandlesticks({
|
|
144
|
+
* market_id: 1,
|
|
145
|
+
* resolution: "1h",
|
|
146
|
+
* start_timestamp: 1234567890,
|
|
147
|
+
* end_timestamp: 1234567900
|
|
148
|
+
* });
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
async getCandlesticks(params) {
|
|
152
|
+
return _chunkNIT6TCVScjs.getCandlesticks.call(void 0, this.axiosInstance, params);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get funding history for a market
|
|
156
|
+
* @param params - Funding query parameters including market_id and time range
|
|
157
|
+
* @returns Array of funding data
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const fundings = await client.getFundings({
|
|
161
|
+
* market_id: 1,
|
|
162
|
+
* start_timestamp: 1234567890,
|
|
163
|
+
* end_timestamp: 1234567900
|
|
164
|
+
* });
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
async getFundings(params) {
|
|
168
|
+
return _chunkQMXZQNBKcjs.getFundings.call(void 0, this.axiosInstance, params);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get exchange statistics
|
|
172
|
+
* @returns Exchange-wide statistics including volume, fees, and markets
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const stats = await client.getExchangeStats();
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
async getExchangeStats() {
|
|
179
|
+
return _chunk6GCE6YQRcjs.getExchangeStats.call(void 0, this.axiosInstance);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get fast bridge information
|
|
183
|
+
* @returns Fast bridge configuration and status
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* const bridgeInfo = await client.getFastBridgeInfo();
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
async getFastBridgeInfo() {
|
|
190
|
+
return _chunkBVC2AA7Ycjs.getFastBridgeInfo.call(void 0, this.axiosInstance);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get current funding rates for all markets
|
|
194
|
+
* @returns Funding rates for all markets
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const rates = await client.getFundingRates();
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
async getFundingRates() {
|
|
201
|
+
return _chunkZ5XTWR2Acjs.getFundingRates.call(void 0, this.axiosInstance);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get the next nonce for an account
|
|
205
|
+
* @param params - Account index to get nonce for
|
|
206
|
+
* @returns Next nonce value
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const nonce = await client.getNextNonce({ account_index: 0 });
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
async getNextNonce(params) {
|
|
213
|
+
return _chunk4MZ3XQUJcjs.getNextNonce.call(void 0, this.axiosInstance, params);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get all order books
|
|
217
|
+
* @returns List of all order books with their configurations
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const orderBooks = await client.getOrderBooks();
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
async getOrderBooks() {
|
|
224
|
+
return _chunkWK6OQRMGcjs.getOrderBooks.call(void 0, this.axiosInstance);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get detailed information about a specific order book
|
|
228
|
+
* @param params - Optional market_id to get details for a specific market
|
|
229
|
+
* @returns Order book details including market information
|
|
230
|
+
* @example
|
|
231
|
+
* ```typescript
|
|
232
|
+
* const details = await client.getOrderBookDetails({ market_id: 1 });
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
async getOrderBookDetails(params) {
|
|
236
|
+
return _chunkBA2QFD27cjs.getOrderBookDetails.call(void 0, this.axiosInstance, params);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Get orders in an order book
|
|
240
|
+
* @param params - Market ID and optional depth/limit parameters
|
|
241
|
+
* @returns Bids and asks in the order book
|
|
242
|
+
* @example
|
|
243
|
+
* ```typescript
|
|
244
|
+
* const orders = await client.getOrderBookOrders({ market_id: 1, limit: 50 });
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
async getOrderBookOrders(params) {
|
|
248
|
+
return _chunkBA2QFD27cjs.getOrderBookOrders.call(void 0, this.axiosInstance, params);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Get recent trades for a market
|
|
252
|
+
* @param params - Market ID and optional limit
|
|
253
|
+
* @returns Recent trades for the market
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* const trades = await client.getRecentTrades({ market_id: 1, limit: 50 });
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
async getRecentTrades(params) {
|
|
260
|
+
return _chunkZKFXRN6Wcjs.getRecentTrades.call(void 0, this.axiosInstance, params);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Get a specific transaction by hash
|
|
264
|
+
* @param params - Transaction hash to look up
|
|
265
|
+
* @returns Transaction details
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* const tx = await client.getTransaction({ tx_hash: "0x..." });
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
async getTransaction(params) {
|
|
272
|
+
return _chunkVNQKWIQGcjs.getTransaction.call(void 0, this.axiosInstance, params);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get transactions with optional filtering
|
|
276
|
+
* @param params - Optional filter parameters for transaction queries
|
|
277
|
+
* @returns List of transactions
|
|
278
|
+
* @example
|
|
279
|
+
* ```typescript
|
|
280
|
+
* const txs = await client.getTransactions({ limit: 50 });
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
async getTransactions(params) {
|
|
284
|
+
return _chunk7U2USLAMcjs.getTransactions.call(void 0, this.axiosInstance, params);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Get L2 transaction from L1 transaction hash
|
|
288
|
+
* @param params - L1 transaction hash
|
|
289
|
+
* @returns Corresponding L2 transaction
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* const tx = await client.getTransactionFromL1TxHash({ l1_tx_hash: "0x..." });
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
async getTransactionFromL1TxHash(params) {
|
|
296
|
+
return _chunkWWLOQFSWcjs.getTransactionFromL1TxHash.call(void 0, this.axiosInstance, params);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Get withdrawal delay in seconds
|
|
300
|
+
* @returns Withdrawal delay configuration
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* const delay = await client.getWithdrawalDelay();
|
|
304
|
+
* console.log(`Withdrawal delay: ${delay.seconds} seconds`);
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
async getWithdrawalDelay() {
|
|
308
|
+
return _chunkQCE5PEXEcjs.getWithdrawalDelay.call(void 0, this.axiosInstance);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Get root status information
|
|
312
|
+
* @returns Root status including network status, network_id, and timestamp
|
|
313
|
+
* @example
|
|
314
|
+
* ```typescript
|
|
315
|
+
* const status = await client.getRootStatus();
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
async getRootStatus() {
|
|
319
|
+
return _chunkIQQRFW4Acjs.getRootStatus.call(void 0, this.axiosInstance);
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
exports.InfoClient = InfoClient;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/api/info-private/account-inactive-orders.ts
|
|
2
|
+
async function getAccountInactiveOrders(client, params, authorization) {
|
|
3
|
+
const config = {
|
|
4
|
+
params: {
|
|
5
|
+
account_index: params.account_index,
|
|
6
|
+
limit: params.limit,
|
|
7
|
+
...params.auth ? { auth: params.auth } : {},
|
|
8
|
+
...params.market_id !== void 0 ? { market_id: params.market_id } : {},
|
|
9
|
+
...params.ask_filter !== void 0 ? { ask_filter: params.ask_filter } : {},
|
|
10
|
+
...params.between_timestamps ? { between_timestamps: params.between_timestamps } : {},
|
|
11
|
+
...params.cursor ? { cursor: params.cursor } : {}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
if (authorization) {
|
|
15
|
+
config.headers = { Authorization: authorization };
|
|
16
|
+
}
|
|
17
|
+
return client.get("/api/v1/accountInactiveOrders", config).then((response) => response.data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
getAccountInactiveOrders
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/info-private/deposit-history.ts
|
|
2
|
+
async function getDepositHistory(client, params, authorization) {
|
|
3
|
+
const config = {
|
|
4
|
+
params: {
|
|
5
|
+
account_index: params.account_index,
|
|
6
|
+
l1_address: params.l1_address,
|
|
7
|
+
...params.cursor ? { cursor: params.cursor } : {},
|
|
8
|
+
...params.filter ? { filter: params.filter } : {}
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
if (authorization) {
|
|
12
|
+
config.headers = { Authorization: authorization };
|
|
13
|
+
}
|
|
14
|
+
return client.get("/api/v1/deposit/history", config).then((response) => response.data);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.getDepositHistory = getDepositHistory;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/info/funding-rates.ts
|
|
2
|
+
async function getFundingRates(client) {
|
|
3
|
+
return client.get("/api/v1/funding-rates").then((response) => response.data);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.getFundingRates = getFundingRates;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/api/info-private/fastwithdraw-info.ts
|
|
2
|
+
async function getFastWithdrawInfo(client, params, authorization) {
|
|
3
|
+
const config = {
|
|
4
|
+
params: {
|
|
5
|
+
account_index: params.account_index,
|
|
6
|
+
...params.auth ? { auth: params.auth } : {}
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
if (authorization) {
|
|
10
|
+
config.headers = { Authorization: authorization };
|
|
11
|
+
}
|
|
12
|
+
return client.get("/api/v1/fastwithdraw/info", config).then((response) => response.data);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
getFastWithdrawInfo
|
|
17
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/exchange/tokens-create.ts
|
|
2
|
+
async function createToken(client, params, authorization) {
|
|
3
|
+
const config = {
|
|
4
|
+
headers: {}
|
|
5
|
+
};
|
|
6
|
+
if (authorization) {
|
|
7
|
+
config.headers = { Authorization: authorization };
|
|
8
|
+
}
|
|
9
|
+
return client.post(
|
|
10
|
+
"/api/v1/tokens/create",
|
|
11
|
+
{
|
|
12
|
+
name: params.name,
|
|
13
|
+
account_index: params.account_index,
|
|
14
|
+
expiry: params.expiry,
|
|
15
|
+
sub_account_access: params.sub_account_access,
|
|
16
|
+
...params.scopes ? { scopes: params.scopes } : { scopes: "read.*" }
|
|
17
|
+
},
|
|
18
|
+
config
|
|
19
|
+
).then((response) => response.data);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.createToken = createToken;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/api/exchange/send-tx-batch.ts
|
|
2
|
+
async function sendTransactionBatch(client, params) {
|
|
3
|
+
if ("tx_types" in params && "tx_infos" in params) {
|
|
4
|
+
const urlParams = new URLSearchParams();
|
|
5
|
+
urlParams.append("tx_types", params.tx_types);
|
|
6
|
+
urlParams.append("tx_infos", params.tx_infos);
|
|
7
|
+
return client.post("/api/v1/sendTxBatch", urlParams, {
|
|
8
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
9
|
+
}).then((response) => response.data);
|
|
10
|
+
} else if ("transactions" in params) {
|
|
11
|
+
return client.post("/api/v1/sendTxBatch", {
|
|
12
|
+
account_index: params.account_index,
|
|
13
|
+
api_key_index: params.api_key_index,
|
|
14
|
+
transactions: params.transactions
|
|
15
|
+
}).then((response) => response.data);
|
|
16
|
+
}
|
|
17
|
+
throw new Error("Invalid batch params: must provide either (tx_types, tx_infos) or (transactions)");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.sendTransactionBatch = sendTransactionBatch;
|