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,539 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sendTransactionBatch
|
|
3
|
+
} from "./chunk-JNTYHWDJ.js";
|
|
4
|
+
import {
|
|
5
|
+
sendTransaction,
|
|
6
|
+
sendTx,
|
|
7
|
+
sendTxJson,
|
|
8
|
+
sendTxWithIndices
|
|
9
|
+
} from "./chunk-76SPKVHT.js";
|
|
10
|
+
import {
|
|
11
|
+
createToken
|
|
12
|
+
} from "./chunk-VW77SNCY.js";
|
|
13
|
+
import {
|
|
14
|
+
revokeToken
|
|
15
|
+
} from "./chunk-UORSMHI2.js";
|
|
16
|
+
import {
|
|
17
|
+
changeAccountTier
|
|
18
|
+
} from "./chunk-5WEMEUUI.js";
|
|
19
|
+
import {
|
|
20
|
+
fastWithdraw
|
|
21
|
+
} from "./chunk-SA6CXVP6.js";
|
|
22
|
+
import {
|
|
23
|
+
acknowledgeNotification
|
|
24
|
+
} from "./chunk-FJJWUBKM.js";
|
|
25
|
+
|
|
26
|
+
// src/client/exchange-client.ts
|
|
27
|
+
import axios from "axios";
|
|
28
|
+
var ExchangeClient = class {
|
|
29
|
+
constructor(config) {
|
|
30
|
+
this.baseURL = config?.baseURL || "https://mainnet.zklighter.elliot.ai";
|
|
31
|
+
this.wasmSigning = config.wasmSigner;
|
|
32
|
+
this.axiosInstance = this.createAxiosInstance();
|
|
33
|
+
}
|
|
34
|
+
createAxiosInstance() {
|
|
35
|
+
return axios.create({
|
|
36
|
+
baseURL: this.baseURL
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Send a transaction
|
|
41
|
+
* @param params - Transaction parameters
|
|
42
|
+
* @returns Promise<TxHashResponse>
|
|
43
|
+
*/
|
|
44
|
+
async sendTransaction(params) {
|
|
45
|
+
return sendTransaction(this.axiosInstance, params);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Send a transaction with form data
|
|
49
|
+
* @param params - Transaction form parameters
|
|
50
|
+
* @returns Promise<TxHashResponse>
|
|
51
|
+
*/
|
|
52
|
+
async sendTx(params) {
|
|
53
|
+
return sendTx(this.axiosInstance, params);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Send a transaction with account and API key indices
|
|
57
|
+
* @param params - Transaction parameters with indices
|
|
58
|
+
* @returns Promise<TxHashResponse>
|
|
59
|
+
*/
|
|
60
|
+
async sendTxWithIndices(params) {
|
|
61
|
+
return sendTxWithIndices(this.axiosInstance, params);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Send a transaction with JSON payload
|
|
65
|
+
* @param params - Transaction parameters
|
|
66
|
+
* @returns Promise<TxHashResponse>
|
|
67
|
+
*/
|
|
68
|
+
async sendTxJson(params) {
|
|
69
|
+
return sendTxJson(this.axiosInstance, params);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Send a batch of transactions
|
|
73
|
+
* @param params - Batch transaction parameters
|
|
74
|
+
* @returns Promise<TxHashesResponse>
|
|
75
|
+
*/
|
|
76
|
+
async sendTransactionBatch(params) {
|
|
77
|
+
return sendTransactionBatch(this.axiosInstance, params);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create and send an order using WASM signing
|
|
81
|
+
* @param params - Order parameters
|
|
82
|
+
* @returns Promise<TxHashResponse>
|
|
83
|
+
* @throws Error if WasmSigning is not configured
|
|
84
|
+
*/
|
|
85
|
+
async createOrder(params) {
|
|
86
|
+
if (!this.wasmSigning) {
|
|
87
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
88
|
+
}
|
|
89
|
+
const txResponse = this.wasmSigning.signCreateOrder(
|
|
90
|
+
params.marketIndex,
|
|
91
|
+
params.clientOrderIndex,
|
|
92
|
+
params.baseAmount,
|
|
93
|
+
params.price,
|
|
94
|
+
params.isAsk,
|
|
95
|
+
params.orderType,
|
|
96
|
+
params.timeInForce,
|
|
97
|
+
params.reduceOnly,
|
|
98
|
+
params.triggerPrice,
|
|
99
|
+
params.orderExpiry,
|
|
100
|
+
params.nonce
|
|
101
|
+
);
|
|
102
|
+
if (txResponse.error) {
|
|
103
|
+
throw new Error(`Failed to sign order: ${txResponse.error}`);
|
|
104
|
+
}
|
|
105
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
106
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
107
|
+
}
|
|
108
|
+
return this.sendTx({
|
|
109
|
+
tx_type: parseInt(txResponse.txType),
|
|
110
|
+
tx_info: txResponse.txInfo,
|
|
111
|
+
price_protection: params.priceProtection
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Cancel an order using WASM signing
|
|
116
|
+
* @param params - Cancel order parameters
|
|
117
|
+
* @returns Promise<TxHashResponse>
|
|
118
|
+
* @throws Error if WasmSigning is not configured
|
|
119
|
+
*/
|
|
120
|
+
async cancelOrder(params) {
|
|
121
|
+
if (!this.wasmSigning) {
|
|
122
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
123
|
+
}
|
|
124
|
+
const txResponse = this.wasmSigning.signCancelOrder(params.marketIndex, params.orderIndex, params.nonce);
|
|
125
|
+
if (txResponse.error) {
|
|
126
|
+
throw new Error(`Failed to sign cancel order: ${txResponse.error}`);
|
|
127
|
+
}
|
|
128
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
129
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
130
|
+
}
|
|
131
|
+
return this.sendTx({
|
|
132
|
+
tx_type: parseInt(txResponse.txType),
|
|
133
|
+
tx_info: txResponse.txInfo,
|
|
134
|
+
price_protection: params.priceProtection
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Cancel all orders using WASM signing
|
|
139
|
+
* @param params - Cancel all orders parameters
|
|
140
|
+
* @returns Promise<TxHashResponse>
|
|
141
|
+
* @throws Error if WasmSigning is not configured
|
|
142
|
+
*/
|
|
143
|
+
async cancelAllOrders(params) {
|
|
144
|
+
if (!this.wasmSigning) {
|
|
145
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
146
|
+
}
|
|
147
|
+
const txResponse = this.wasmSigning.signCancelAllOrders(params.timeInForce, params.time, params.nonce);
|
|
148
|
+
if (txResponse.error) {
|
|
149
|
+
throw new Error(`Failed to sign cancel all orders: ${txResponse.error}`);
|
|
150
|
+
}
|
|
151
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
152
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
153
|
+
}
|
|
154
|
+
return this.sendTx({
|
|
155
|
+
tx_type: parseInt(txResponse.txType),
|
|
156
|
+
tx_info: txResponse.txInfo,
|
|
157
|
+
price_protection: params.priceProtection
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Transfer funds using WASM signing
|
|
162
|
+
* @param params - Transfer parameters
|
|
163
|
+
* @returns Promise<TxHashResponse>
|
|
164
|
+
* @throws Error if WasmSigning is not configured
|
|
165
|
+
*/
|
|
166
|
+
async transfer(params) {
|
|
167
|
+
if (!this.wasmSigning) {
|
|
168
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
169
|
+
}
|
|
170
|
+
const txResponse = this.wasmSigning.signTransfer(params.toAccount, params.usdcAmount, params.fee, params.memo, params.nonce);
|
|
171
|
+
if (txResponse.error) {
|
|
172
|
+
throw new Error(`Failed to sign transfer: ${txResponse.error}`);
|
|
173
|
+
}
|
|
174
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
175
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
176
|
+
}
|
|
177
|
+
return this.sendTx({
|
|
178
|
+
tx_type: parseInt(txResponse.txType),
|
|
179
|
+
tx_info: txResponse.txInfo,
|
|
180
|
+
price_protection: params.priceProtection
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Withdraw funds using WASM signing
|
|
185
|
+
* @param params - Withdraw parameters
|
|
186
|
+
* @returns Promise<TxHashResponse>
|
|
187
|
+
* @throws Error if WasmSigning is not configured
|
|
188
|
+
*/
|
|
189
|
+
async withdraw(params) {
|
|
190
|
+
if (!this.wasmSigning) {
|
|
191
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
192
|
+
}
|
|
193
|
+
const txResponse = this.wasmSigning.signWithdraw(params.usdcAmount, params.nonce);
|
|
194
|
+
if (txResponse.error) {
|
|
195
|
+
throw new Error(`Failed to sign withdraw: ${txResponse.error}`);
|
|
196
|
+
}
|
|
197
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
198
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
199
|
+
}
|
|
200
|
+
return this.sendTx({
|
|
201
|
+
tx_type: parseInt(txResponse.txType),
|
|
202
|
+
tx_info: txResponse.txInfo,
|
|
203
|
+
price_protection: params.priceProtection
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Update leverage using WASM signing
|
|
208
|
+
* @param params - Update leverage parameters
|
|
209
|
+
* @returns Promise<TxHashResponse>
|
|
210
|
+
* @throws Error if WasmSigning is not configured
|
|
211
|
+
*/
|
|
212
|
+
async updateLeverage(params) {
|
|
213
|
+
if (!this.wasmSigning) {
|
|
214
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
215
|
+
}
|
|
216
|
+
const txResponse = this.wasmSigning.signUpdateLeverage(params.marketIndex, params.fraction, params.marginMode, params.nonce);
|
|
217
|
+
if (txResponse.error) {
|
|
218
|
+
throw new Error(`Failed to sign update leverage: ${txResponse.error}`);
|
|
219
|
+
}
|
|
220
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
221
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
222
|
+
}
|
|
223
|
+
return this.sendTx({
|
|
224
|
+
tx_type: parseInt(txResponse.txType),
|
|
225
|
+
tx_info: txResponse.txInfo,
|
|
226
|
+
price_protection: params.priceProtection
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Modify an order using WASM signing
|
|
231
|
+
* @param params - Modify order parameters
|
|
232
|
+
* @returns Promise<TxHashResponse>
|
|
233
|
+
* @throws Error if WasmSigning is not configured
|
|
234
|
+
*/
|
|
235
|
+
async modifyOrder(params) {
|
|
236
|
+
if (!this.wasmSigning) {
|
|
237
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
238
|
+
}
|
|
239
|
+
const txResponse = this.wasmSigning.signModifyOrder(params.marketIndex, params.index, params.baseAmount, params.price, params.triggerPrice, params.nonce);
|
|
240
|
+
if (txResponse.error) {
|
|
241
|
+
throw new Error(`Failed to sign modify order: ${txResponse.error}`);
|
|
242
|
+
}
|
|
243
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
244
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
245
|
+
}
|
|
246
|
+
return this.sendTx({
|
|
247
|
+
tx_type: parseInt(txResponse.txType),
|
|
248
|
+
tx_info: txResponse.txInfo,
|
|
249
|
+
price_protection: params.priceProtection
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Create a subaccount using WASM signing
|
|
254
|
+
* @param params - Create subaccount parameters
|
|
255
|
+
* @returns Promise<TxHashResponse>
|
|
256
|
+
* @throws Error if WasmSigning is not configured
|
|
257
|
+
*/
|
|
258
|
+
async createSubAccount(params) {
|
|
259
|
+
if (!this.wasmSigning) {
|
|
260
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
261
|
+
}
|
|
262
|
+
const txResponse = this.wasmSigning.signCreateSubAccount(params.nonce);
|
|
263
|
+
if (txResponse.error) {
|
|
264
|
+
throw new Error(`Failed to sign create sub-account: ${txResponse.error}`);
|
|
265
|
+
}
|
|
266
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
267
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
268
|
+
}
|
|
269
|
+
return this.sendTx({
|
|
270
|
+
tx_type: parseInt(txResponse.txType),
|
|
271
|
+
tx_info: txResponse.txInfo,
|
|
272
|
+
price_protection: params.priceProtection
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Create a public pool using WASM signing
|
|
277
|
+
* @param params - Create public pool parameters
|
|
278
|
+
* @returns Promise<TxHashResponse>
|
|
279
|
+
* @throws Error if WasmSigning is not configured
|
|
280
|
+
*/
|
|
281
|
+
async createPublicPool(params) {
|
|
282
|
+
if (!this.wasmSigning) {
|
|
283
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
284
|
+
}
|
|
285
|
+
const txResponse = this.wasmSigning.signCreatePublicPool(params.operatorFee, params.initialTotalShares, params.minOperatorShareRate, params.nonce);
|
|
286
|
+
if (txResponse.error) {
|
|
287
|
+
throw new Error(`Failed to sign create public pool: ${txResponse.error}`);
|
|
288
|
+
}
|
|
289
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
290
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
291
|
+
}
|
|
292
|
+
return this.sendTx({
|
|
293
|
+
tx_type: parseInt(txResponse.txType),
|
|
294
|
+
tx_info: txResponse.txInfo,
|
|
295
|
+
price_protection: params.priceProtection
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Update a public pool using WASM signing
|
|
300
|
+
* @param params - Update public pool parameters
|
|
301
|
+
* @returns Promise<TxHashResponse>
|
|
302
|
+
* @throws Error if WasmSigning is not configured
|
|
303
|
+
*/
|
|
304
|
+
async updatePublicPool(params) {
|
|
305
|
+
if (!this.wasmSigning) {
|
|
306
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
307
|
+
}
|
|
308
|
+
const txResponse = this.wasmSigning.signUpdatePublicPool(params.publicPoolIndex, params.status, params.operatorFee, params.minOperatorShareRate, params.nonce);
|
|
309
|
+
if (txResponse.error) {
|
|
310
|
+
throw new Error(`Failed to sign update public pool: ${txResponse.error}`);
|
|
311
|
+
}
|
|
312
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
313
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
314
|
+
}
|
|
315
|
+
return this.sendTx({
|
|
316
|
+
tx_type: parseInt(txResponse.txType),
|
|
317
|
+
tx_info: txResponse.txInfo,
|
|
318
|
+
price_protection: params.priceProtection
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Mint shares using WASM signing
|
|
323
|
+
* @param params - Mint shares parameters
|
|
324
|
+
* @returns Promise<TxHashResponse>
|
|
325
|
+
* @throws Error if WasmSigning is not configured
|
|
326
|
+
*/
|
|
327
|
+
async mintShares(params) {
|
|
328
|
+
if (!this.wasmSigning) {
|
|
329
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
330
|
+
}
|
|
331
|
+
const txResponse = this.wasmSigning.signMintShares(params.publicPoolIndex, params.shareAmount, params.nonce);
|
|
332
|
+
if (txResponse.error) {
|
|
333
|
+
throw new Error(`Failed to sign mint shares: ${txResponse.error}`);
|
|
334
|
+
}
|
|
335
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
336
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
337
|
+
}
|
|
338
|
+
return this.sendTx({
|
|
339
|
+
tx_type: parseInt(txResponse.txType),
|
|
340
|
+
tx_info: txResponse.txInfo,
|
|
341
|
+
price_protection: params.priceProtection
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Burn shares using WASM signing
|
|
346
|
+
* @param params - Burn shares parameters
|
|
347
|
+
* @returns Promise<TxHashResponse>
|
|
348
|
+
* @throws Error if WasmSigning is not configured
|
|
349
|
+
*/
|
|
350
|
+
async burnShares(params) {
|
|
351
|
+
if (!this.wasmSigning) {
|
|
352
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
353
|
+
}
|
|
354
|
+
const txResponse = this.wasmSigning.signBurnShares(params.publicPoolIndex, params.shareAmount, params.nonce);
|
|
355
|
+
if (txResponse.error) {
|
|
356
|
+
throw new Error(`Failed to sign burn shares: ${txResponse.error}`);
|
|
357
|
+
}
|
|
358
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
359
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
360
|
+
}
|
|
361
|
+
return this.sendTx({
|
|
362
|
+
tx_type: parseInt(txResponse.txType),
|
|
363
|
+
tx_info: txResponse.txInfo,
|
|
364
|
+
price_protection: params.priceProtection
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Update margin using WASM signing
|
|
369
|
+
* @param params - Update margin parameters
|
|
370
|
+
* @returns Promise<TxHashResponse>
|
|
371
|
+
* @throws Error if WasmSigning is not configured
|
|
372
|
+
*/
|
|
373
|
+
async updateMargin(params) {
|
|
374
|
+
if (!this.wasmSigning) {
|
|
375
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
376
|
+
}
|
|
377
|
+
const txResponse = this.wasmSigning.signUpdateMargin(params.marketIndex, params.usdcAmount, params.direction, params.nonce);
|
|
378
|
+
if (txResponse.error) {
|
|
379
|
+
throw new Error(`Failed to sign update margin: ${txResponse.error}`);
|
|
380
|
+
}
|
|
381
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
382
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
383
|
+
}
|
|
384
|
+
return this.sendTx({
|
|
385
|
+
tx_type: parseInt(txResponse.txType),
|
|
386
|
+
tx_info: txResponse.txInfo,
|
|
387
|
+
price_protection: params.priceProtection
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Create grouped orders using WASM signing
|
|
392
|
+
* @param params - Create grouped orders parameters
|
|
393
|
+
* @returns Promise<TxHashResponse>
|
|
394
|
+
* @throws Error if WasmSigning is not configured
|
|
395
|
+
*/
|
|
396
|
+
async createGroupedOrders(params) {
|
|
397
|
+
if (!this.wasmSigning) {
|
|
398
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
399
|
+
}
|
|
400
|
+
const txResponse = this.wasmSigning.signCreateGroupedOrders(params.groupingType, params.orders, params.nonce);
|
|
401
|
+
if (txResponse.error) {
|
|
402
|
+
throw new Error(`Failed to sign create grouped orders: ${txResponse.error}`);
|
|
403
|
+
}
|
|
404
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
405
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
406
|
+
}
|
|
407
|
+
return this.sendTx({
|
|
408
|
+
tx_type: parseInt(txResponse.txType),
|
|
409
|
+
tx_info: txResponse.txInfo,
|
|
410
|
+
price_protection: params.priceProtection
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Generate change public key L1 sign message
|
|
415
|
+
* @param pubKeyHex - New public key in hex format
|
|
416
|
+
* @param nonce - Account nonce
|
|
417
|
+
* @param accountIndex - Account index
|
|
418
|
+
* @param newApiKeyIndex - New API key index
|
|
419
|
+
* @returns Promise<string> - Sign message
|
|
420
|
+
*/
|
|
421
|
+
async generateChangePubKeyL1SignMessage(pubKeyHex, nonce, accountIndex, newApiKeyIndex) {
|
|
422
|
+
const formatHex16Bytes = (value) => {
|
|
423
|
+
const hex = value.toString(16);
|
|
424
|
+
return "0x" + hex.padStart(16, "0");
|
|
425
|
+
};
|
|
426
|
+
return `Register Lighter Account
|
|
427
|
+
|
|
428
|
+
pubkey: 0x${pubKeyHex.replace("0x", "")}
|
|
429
|
+
nonce: ${formatHex16Bytes(nonce)}
|
|
430
|
+
account index: ${formatHex16Bytes(accountIndex)}
|
|
431
|
+
api key index: ${formatHex16Bytes(newApiKeyIndex)}
|
|
432
|
+
Only sign this message for a trusted client!`;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Change public key using WASM signing
|
|
436
|
+
* @param params - Change public key parameters
|
|
437
|
+
* @returns Promise<TxHashResponse>
|
|
438
|
+
* @throws Error if WasmSigning is not configured
|
|
439
|
+
*/
|
|
440
|
+
async changePubKey(params) {
|
|
441
|
+
if (!this.wasmSigning) {
|
|
442
|
+
throw new Error("WasmSigning not configured. Please provide wasmSigning in ExchangeClientConfig.");
|
|
443
|
+
}
|
|
444
|
+
const txResponse = this.wasmSigning.signChangePubKey(params.pubKeyHex, params.nonce);
|
|
445
|
+
if (txResponse.error) {
|
|
446
|
+
throw new Error(`Failed to sign change pub key: ${txResponse.error}`);
|
|
447
|
+
}
|
|
448
|
+
if (!txResponse.txInfo || !txResponse.txType) {
|
|
449
|
+
throw new Error("Invalid transaction response: missing txInfo or txType");
|
|
450
|
+
}
|
|
451
|
+
const txInfo = JSON.parse(txResponse.txInfo);
|
|
452
|
+
txInfo.L1Sig = params.l1Sig;
|
|
453
|
+
return this.sendTx({
|
|
454
|
+
tx_type: parseInt(txResponse.txType),
|
|
455
|
+
tx_info: JSON.stringify(txInfo),
|
|
456
|
+
price_protection: params.priceProtection
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Acknowledge a notification
|
|
461
|
+
* @param params - Notification acknowledgment parameters
|
|
462
|
+
* @param authorization - Optional authorization token
|
|
463
|
+
* @returns Promise<NotificationAckResponse>
|
|
464
|
+
*/
|
|
465
|
+
async acknowledgeNotification(params, authorization) {
|
|
466
|
+
return acknowledgeNotification(this.axiosInstance, params, authorization);
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Change account tier
|
|
470
|
+
* @param params - Account tier change parameters including account_index and new_tier
|
|
471
|
+
* @param authorization - Optional authorization token
|
|
472
|
+
* @returns Promise<ChangeAccountTierResponse>
|
|
473
|
+
* @example
|
|
474
|
+
* ```typescript
|
|
475
|
+
* const result = await client.changeAccountTier({
|
|
476
|
+
* account_index: 0,
|
|
477
|
+
* new_tier: "premium"
|
|
478
|
+
* });
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
async changeAccountTier(params, authorization) {
|
|
482
|
+
return changeAccountTier(this.axiosInstance, params, authorization);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Fast withdraw funds
|
|
486
|
+
* @param params - Fast withdraw parameters including tx_info and to_address
|
|
487
|
+
* @param authorization - Optional authorization token
|
|
488
|
+
* @returns Promise<FastWithdrawResponse>
|
|
489
|
+
* @example
|
|
490
|
+
* ```typescript
|
|
491
|
+
* const result = await client.fastWithdraw({
|
|
492
|
+
* tx_info: "0x...",
|
|
493
|
+
* to_address: "0x..."
|
|
494
|
+
* });
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
async fastWithdraw(params, authorization) {
|
|
498
|
+
return fastWithdraw(this.axiosInstance, params, authorization);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Create API token
|
|
502
|
+
* @param params - Token creation parameters including name, account_index, expiry, and permissions
|
|
503
|
+
* @param authorization - Optional authorization token
|
|
504
|
+
* @returns Promise<TokensCreateResponse>
|
|
505
|
+
* @example
|
|
506
|
+
* ```typescript
|
|
507
|
+
* const token = await client.createToken({
|
|
508
|
+
* name: "My API Token",
|
|
509
|
+
* account_index: 0,
|
|
510
|
+
* expiry: Math.floor(Date.now() / 1000) + 86400 * 30, // 30 days
|
|
511
|
+
* sub_account_access: true,
|
|
512
|
+
* scopes: "read.*"
|
|
513
|
+
* });
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
async createToken(params, authorization) {
|
|
517
|
+
return createToken(this.axiosInstance, params, authorization);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Revoke API token
|
|
521
|
+
* @param params - Token revocation parameters including token_id and account_index
|
|
522
|
+
* @param authorization - Optional authorization token
|
|
523
|
+
* @returns Promise<TokensRevokeResponse>
|
|
524
|
+
* @example
|
|
525
|
+
* ```typescript
|
|
526
|
+
* const result = await client.revokeToken({
|
|
527
|
+
* token_id: 123,
|
|
528
|
+
* account_index: 0
|
|
529
|
+
* });
|
|
530
|
+
* ```
|
|
531
|
+
*/
|
|
532
|
+
async revokeToken(params, authorization) {
|
|
533
|
+
return revokeToken(this.axiosInstance, params, authorization);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
export {
|
|
538
|
+
ExchangeClient
|
|
539
|
+
};
|