extended-typescript-sdk 0.0.7 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/cjs/config.d.ts +2 -2
  2. package/dist/cjs/config.js +1 -1
  3. package/dist/cjs/index.d.ts +3 -1
  4. package/dist/cjs/index.d.ts.map +1 -1
  5. package/dist/cjs/index.js +12 -3
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/cjs/perpetual/amounts.d.ts.map +1 -1
  8. package/dist/cjs/perpetual/amounts.js +1 -8
  9. package/dist/cjs/perpetual/amounts.js.map +1 -1
  10. package/dist/cjs/perpetual/assets.d.ts +1 -1
  11. package/dist/cjs/perpetual/assets.d.ts.map +1 -1
  12. package/dist/cjs/perpetual/assets.js +2 -3
  13. package/dist/cjs/perpetual/assets.js.map +1 -1
  14. package/dist/cjs/perpetual/crypto/signer.d.ts +2 -0
  15. package/dist/cjs/perpetual/crypto/signer.d.ts.map +1 -1
  16. package/dist/cjs/perpetual/crypto/signer.js +11 -1
  17. package/dist/cjs/perpetual/crypto/signer.js.map +1 -1
  18. package/dist/cjs/perpetual/order-object-settlement.d.ts +2 -1
  19. package/dist/cjs/perpetual/order-object-settlement.d.ts.map +1 -1
  20. package/dist/cjs/perpetual/order-object-settlement.js +3 -1
  21. package/dist/cjs/perpetual/order-object-settlement.js.map +1 -1
  22. package/dist/cjs/perpetual/order-object.d.ts.map +1 -1
  23. package/dist/cjs/perpetual/order-object.js +14 -2
  24. package/dist/cjs/perpetual/order-object.js.map +1 -1
  25. package/dist/cjs/perpetual/orderbook.d.ts +48 -0
  26. package/dist/cjs/perpetual/orderbook.d.ts.map +1 -0
  27. package/dist/cjs/perpetual/orderbook.js +266 -0
  28. package/dist/cjs/perpetual/orderbook.js.map +1 -0
  29. package/dist/cjs/perpetual/orders.d.ts +4 -2
  30. package/dist/cjs/perpetual/orders.d.ts.map +1 -1
  31. package/dist/cjs/perpetual/orders.js +3 -1
  32. package/dist/cjs/perpetual/orders.js.map +1 -1
  33. package/dist/cjs/perpetual/simple-client/blocking-trading-client.d.ts +59 -0
  34. package/dist/cjs/perpetual/simple-client/blocking-trading-client.d.ts.map +1 -0
  35. package/dist/cjs/perpetual/simple-client/blocking-trading-client.js +198 -0
  36. package/dist/cjs/perpetual/simple-client/blocking-trading-client.js.map +1 -0
  37. package/dist/config.d.ts +11 -0
  38. package/dist/config.d.ts.map +1 -0
  39. package/dist/config.js +15 -0
  40. package/dist/config.js.map +1 -0
  41. package/dist/errors.d.ts +25 -0
  42. package/dist/errors.d.ts.map +1 -0
  43. package/dist/errors.js +45 -0
  44. package/dist/errors.js.map +1 -0
  45. package/dist/esm/config.d.ts +2 -2
  46. package/dist/esm/config.js +1 -1
  47. package/dist/esm/index.d.ts +3 -1
  48. package/dist/esm/index.d.ts.map +1 -1
  49. package/dist/esm/index.js +4 -1
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/perpetual/amounts.d.ts.map +1 -1
  52. package/dist/esm/perpetual/amounts.js +1 -8
  53. package/dist/esm/perpetual/amounts.js.map +1 -1
  54. package/dist/esm/perpetual/assets.d.ts +1 -1
  55. package/dist/esm/perpetual/assets.d.ts.map +1 -1
  56. package/dist/esm/perpetual/assets.js +2 -3
  57. package/dist/esm/perpetual/assets.js.map +1 -1
  58. package/dist/esm/perpetual/crypto/signer.d.ts +2 -0
  59. package/dist/esm/perpetual/crypto/signer.d.ts.map +1 -1
  60. package/dist/esm/perpetual/crypto/signer.js +10 -1
  61. package/dist/esm/perpetual/crypto/signer.js.map +1 -1
  62. package/dist/esm/perpetual/order-object-settlement.d.ts +2 -1
  63. package/dist/esm/perpetual/order-object-settlement.d.ts.map +1 -1
  64. package/dist/esm/perpetual/order-object-settlement.js +3 -1
  65. package/dist/esm/perpetual/order-object-settlement.js.map +1 -1
  66. package/dist/esm/perpetual/order-object.d.ts.map +1 -1
  67. package/dist/esm/perpetual/order-object.js +14 -2
  68. package/dist/esm/perpetual/order-object.js.map +1 -1
  69. package/dist/esm/perpetual/orderbook.d.ts +48 -0
  70. package/dist/esm/perpetual/orderbook.d.ts.map +1 -0
  71. package/dist/esm/perpetual/orderbook.js +257 -0
  72. package/dist/esm/perpetual/orderbook.js.map +1 -0
  73. package/dist/esm/perpetual/orders.d.ts +4 -2
  74. package/dist/esm/perpetual/orders.d.ts.map +1 -1
  75. package/dist/esm/perpetual/orders.js +3 -1
  76. package/dist/esm/perpetual/orders.js.map +1 -1
  77. package/dist/esm/perpetual/simple-client/blocking-trading-client.d.ts +59 -0
  78. package/dist/esm/perpetual/simple-client/blocking-trading-client.d.ts.map +1 -0
  79. package/dist/esm/perpetual/simple-client/blocking-trading-client.js +192 -0
  80. package/dist/esm/perpetual/simple-client/blocking-trading-client.js.map +1 -0
  81. package/dist/index.d.ts +42 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +155 -0
  84. package/dist/index.js.map +1 -0
  85. package/dist/perpetual/accounts.d.ts +147 -0
  86. package/dist/perpetual/accounts.d.ts.map +1 -0
  87. package/dist/perpetual/accounts.js +236 -0
  88. package/dist/perpetual/accounts.js.map +1 -0
  89. package/dist/perpetual/amounts.d.ts +41 -0
  90. package/dist/perpetual/amounts.d.ts.map +1 -0
  91. package/dist/perpetual/amounts.js +79 -0
  92. package/dist/perpetual/amounts.js.map +1 -0
  93. package/dist/perpetual/assets.d.ts +74 -0
  94. package/dist/perpetual/assets.d.ts.map +1 -0
  95. package/dist/perpetual/assets.js +119 -0
  96. package/dist/perpetual/assets.js.map +1 -0
  97. package/dist/perpetual/bridges.d.ts +29 -0
  98. package/dist/perpetual/bridges.d.ts.map +1 -0
  99. package/dist/perpetual/bridges.js +45 -0
  100. package/dist/perpetual/bridges.js.map +1 -0
  101. package/dist/perpetual/candles.d.ts +26 -0
  102. package/dist/perpetual/candles.d.ts.map +1 -0
  103. package/dist/perpetual/candles.js +29 -0
  104. package/dist/perpetual/candles.js.map +1 -0
  105. package/dist/perpetual/clients.d.ts +15 -0
  106. package/dist/perpetual/clients.d.ts.map +1 -0
  107. package/dist/perpetual/clients.js +25 -0
  108. package/dist/perpetual/clients.js.map +1 -0
  109. package/dist/perpetual/configuration.d.ts +39 -0
  110. package/dist/perpetual/configuration.d.ts.map +1 -0
  111. package/dist/perpetual/configuration.js +61 -0
  112. package/dist/perpetual/configuration.js.map +1 -0
  113. package/dist/perpetual/crypto/signer.d.ts +166 -0
  114. package/dist/perpetual/crypto/signer.d.ts.map +1 -0
  115. package/dist/perpetual/crypto/signer.js +342 -0
  116. package/dist/perpetual/crypto/signer.js.map +1 -0
  117. package/dist/perpetual/custom-signer.d.ts +51 -0
  118. package/dist/perpetual/custom-signer.d.ts.map +1 -0
  119. package/dist/perpetual/custom-signer.js +18 -0
  120. package/dist/perpetual/custom-signer.js.map +1 -0
  121. package/dist/perpetual/fees.d.ts +20 -0
  122. package/dist/perpetual/fees.d.ts.map +1 -0
  123. package/dist/perpetual/fees.js +35 -0
  124. package/dist/perpetual/fees.js.map +1 -0
  125. package/dist/perpetual/funding-rates.d.ts +15 -0
  126. package/dist/perpetual/funding-rates.d.ts.map +1 -0
  127. package/dist/perpetual/funding-rates.js +23 -0
  128. package/dist/perpetual/funding-rates.js.map +1 -0
  129. package/dist/perpetual/markets.d.ts +83 -0
  130. package/dist/perpetual/markets.d.ts.map +1 -0
  131. package/dist/perpetual/markets.js +124 -0
  132. package/dist/perpetual/markets.js.map +1 -0
  133. package/dist/perpetual/order-object-settlement.d.ts +44 -0
  134. package/dist/perpetual/order-object-settlement.d.ts.map +1 -0
  135. package/dist/perpetual/order-object-settlement.js +123 -0
  136. package/dist/perpetual/order-object-settlement.js.map +1 -0
  137. package/dist/perpetual/order-object.d.ts +38 -0
  138. package/dist/perpetual/order-object.d.ts.map +1 -0
  139. package/dist/perpetual/order-object.js +102 -0
  140. package/dist/perpetual/order-object.js.map +1 -0
  141. package/dist/perpetual/orderbook.d.ts +48 -0
  142. package/dist/perpetual/orderbook.d.ts.map +1 -0
  143. package/dist/perpetual/orderbook.js +265 -0
  144. package/dist/perpetual/orderbook.js.map +1 -0
  145. package/dist/perpetual/orderbooks.d.ts +23 -0
  146. package/dist/perpetual/orderbooks.d.ts.map +1 -0
  147. package/dist/perpetual/orderbooks.js +36 -0
  148. package/dist/perpetual/orderbooks.js.map +1 -0
  149. package/dist/perpetual/orders.d.ts +209 -0
  150. package/dist/perpetual/orders.d.ts.map +1 -0
  151. package/dist/perpetual/orders.js +268 -0
  152. package/dist/perpetual/orders.js.map +1 -0
  153. package/dist/perpetual/positions.d.ts +80 -0
  154. package/dist/perpetual/positions.d.ts.map +1 -0
  155. package/dist/perpetual/positions.js +94 -0
  156. package/dist/perpetual/positions.js.map +1 -0
  157. package/dist/perpetual/simple-client/blocking-trading-client.d.ts +59 -0
  158. package/dist/perpetual/simple-client/blocking-trading-client.d.ts.map +1 -0
  159. package/dist/perpetual/simple-client/blocking-trading-client.js +197 -0
  160. package/dist/perpetual/simple-client/blocking-trading-client.js.map +1 -0
  161. package/dist/perpetual/stream-client/perpetual-stream-connection.d.ts +47 -0
  162. package/dist/perpetual/stream-client/perpetual-stream-connection.d.ts.map +1 -0
  163. package/dist/perpetual/stream-client/perpetual-stream-connection.js +125 -0
  164. package/dist/perpetual/stream-client/perpetual-stream-connection.js.map +1 -0
  165. package/dist/perpetual/stream-client/stream-client.d.ts +62 -0
  166. package/dist/perpetual/stream-client/stream-client.d.ts.map +1 -0
  167. package/dist/perpetual/stream-client/stream-client.js +107 -0
  168. package/dist/perpetual/stream-client/stream-client.js.map +1 -0
  169. package/dist/perpetual/trades.d.ts +44 -0
  170. package/dist/perpetual/trades.d.ts.map +1 -0
  171. package/dist/perpetual/trades.js +48 -0
  172. package/dist/perpetual/trades.js.map +1 -0
  173. package/dist/perpetual/trading-client/account-module.d.ts +192 -0
  174. package/dist/perpetual/trading-client/account-module.d.ts.map +1 -0
  175. package/dist/perpetual/trading-client/account-module.js +359 -0
  176. package/dist/perpetual/trading-client/account-module.js.map +1 -0
  177. package/dist/perpetual/trading-client/base-module.d.ts +27 -0
  178. package/dist/perpetual/trading-client/base-module.d.ts.map +1 -0
  179. package/dist/perpetual/trading-client/base-module.js +49 -0
  180. package/dist/perpetual/trading-client/base-module.js.map +1 -0
  181. package/dist/perpetual/trading-client/info-module.d.ts +24 -0
  182. package/dist/perpetual/trading-client/info-module.d.ts.map +1 -0
  183. package/dist/perpetual/trading-client/info-module.js +33 -0
  184. package/dist/perpetual/trading-client/info-module.js.map +1 -0
  185. package/dist/perpetual/trading-client/markets-information-module.d.ts +53 -0
  186. package/dist/perpetual/trading-client/markets-information-module.d.ts.map +1 -0
  187. package/dist/perpetual/trading-client/markets-information-module.js +106 -0
  188. package/dist/perpetual/trading-client/markets-information-module.js.map +1 -0
  189. package/dist/perpetual/trading-client/order-management-module.d.ts +40 -0
  190. package/dist/perpetual/trading-client/order-management-module.d.ts.map +1 -0
  191. package/dist/perpetual/trading-client/order-management-module.js +71 -0
  192. package/dist/perpetual/trading-client/order-management-module.js.map +1 -0
  193. package/dist/perpetual/trading-client/testnet-module.d.ts +27 -0
  194. package/dist/perpetual/trading-client/testnet-module.d.ts.map +1 -0
  195. package/dist/perpetual/trading-client/testnet-module.js +45 -0
  196. package/dist/perpetual/trading-client/testnet-module.js.map +1 -0
  197. package/dist/perpetual/trading-client/trading-client.d.ts +75 -0
  198. package/dist/perpetual/trading-client/trading-client.d.ts.map +1 -0
  199. package/dist/perpetual/trading-client/trading-client.js +115 -0
  200. package/dist/perpetual/trading-client/trading-client.js.map +1 -0
  201. package/dist/perpetual/transfer-object.d.ts +12 -0
  202. package/dist/perpetual/transfer-object.d.ts.map +1 -0
  203. package/dist/perpetual/transfer-object.js +57 -0
  204. package/dist/perpetual/transfer-object.js.map +1 -0
  205. package/dist/perpetual/transfers.d.ts +54 -0
  206. package/dist/perpetual/transfers.d.ts.map +1 -0
  207. package/dist/perpetual/transfers.js +90 -0
  208. package/dist/perpetual/transfers.js.map +1 -0
  209. package/dist/perpetual/user-client/onboarding.d.ts +101 -0
  210. package/dist/perpetual/user-client/onboarding.d.ts.map +1 -0
  211. package/dist/perpetual/user-client/onboarding.js +247 -0
  212. package/dist/perpetual/user-client/onboarding.js.map +1 -0
  213. package/dist/perpetual/user-client/user-client.d.ts +45 -0
  214. package/dist/perpetual/user-client/user-client.d.ts.map +1 -0
  215. package/dist/perpetual/user-client/user-client.js +185 -0
  216. package/dist/perpetual/user-client/user-client.js.map +1 -0
  217. package/dist/perpetual/withdrawal-object.d.ts +12 -0
  218. package/dist/perpetual/withdrawal-object.d.ts.map +1 -0
  219. package/dist/perpetual/withdrawal-object.js +51 -0
  220. package/dist/perpetual/withdrawal-object.js.map +1 -0
  221. package/dist/perpetual/withdrawals.d.ts +40 -0
  222. package/dist/perpetual/withdrawals.d.ts.map +1 -0
  223. package/dist/perpetual/withdrawals.js +65 -0
  224. package/dist/perpetual/withdrawals.js.map +1 -0
  225. package/dist/utils/date.d.ts +13 -0
  226. package/dist/utils/date.d.ts.map +1 -0
  227. package/dist/utils/date.js +21 -0
  228. package/dist/utils/date.js.map +1 -0
  229. package/dist/utils/env.d.ts +50 -0
  230. package/dist/utils/env.d.ts.map +1 -0
  231. package/dist/utils/env.js +157 -0
  232. package/dist/utils/env.js.map +1 -0
  233. package/dist/utils/http.d.ts +98 -0
  234. package/dist/utils/http.d.ts.map +1 -0
  235. package/dist/utils/http.js +290 -0
  236. package/dist/utils/http.js.map +1 -0
  237. package/dist/utils/model.d.ts +35 -0
  238. package/dist/utils/model.d.ts.map +1 -0
  239. package/dist/utils/model.js +86 -0
  240. package/dist/utils/model.js.map +1 -0
  241. package/dist/utils/nonce.d.ts +9 -0
  242. package/dist/utils/nonce.d.ts.map +1 -0
  243. package/dist/utils/nonce.js +14 -0
  244. package/dist/utils/nonce.js.map +1 -0
  245. package/dist/utils/string.d.ts +10 -0
  246. package/dist/utils/string.d.ts.map +1 -0
  247. package/dist/utils/string.js +20 -0
  248. package/dist/utils/string.js.map +1 -0
  249. package/package.json +91 -91
  250. package/wasm/stark_crypto_wasm.d-web.ts +34 -26
  251. package/wasm/stark_crypto_wasm.d.ts +34 -26
  252. package/wasm/stark_crypto_wasm.js +113 -111
  253. package/wasm/stark_crypto_wasm_bg-web.js +101 -108
  254. package/wasm/stark_crypto_wasm_bg-web.wasm +0 -0
  255. package/wasm/stark_crypto_wasm_bg.wasm +0 -0
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Extended TypeScript Trading SDK
3
+ *
4
+ * Unofficial TypeScript client for Extended Exchange API
5
+ * Built and maintained by the community
6
+ *
7
+ * Extended is a perpetual DEX, built by an ex-Revolut team.
8
+ * Extended offers perpetual contracts on both crypto and TradFi assets,
9
+ * with USDC as collateral and leverage of up to 100x.
10
+ */
11
+ export { initWasm } from './perpetual/crypto/signer';
12
+ export { EndpointConfig, StarknetDomain, TESTNET_CONFIG, MAINNET_CONFIG } from './perpetual/configuration';
13
+ export { StarkPerpetualAccount, AccountModel, AccountLeverage, BalanceModel, createStarkPerpetualAccountWithCustomSigner } from './perpetual/accounts';
14
+ export { CustomStarkSigner, SignatureResult, isCustomStarkSigner } from './perpetual/custom-signer';
15
+ export { OrderSide, OrderType, OrderStatus, OrderStatusReason, TimeInForce, OrderTpslType, SelfTradeProtectionLevel, OrderPriceType, OrderTriggerPriceType, NewOrderModel, PlacedOrderModel, OpenOrderModel, CreateOrderTpslTriggerModel, } from './perpetual/orders';
16
+ export { PerpetualTradingClient } from './perpetual/trading-client/trading-client';
17
+ export { AccountModule } from './perpetual/trading-client/account-module';
18
+ export { OrderManagementModule } from './perpetual/trading-client/order-management-module';
19
+ export { MarketsInformationModule } from './perpetual/trading-client/markets-information-module';
20
+ export { InfoModule } from './perpetual/trading-client/info-module';
21
+ export { TestnetModule } from './perpetual/trading-client/testnet-module';
22
+ export { UserClient } from './perpetual/user-client/user-client';
23
+ export { OnBoardedAccount, StarkKeyPair } from './perpetual/user-client/onboarding';
24
+ export { PerpetualStreamClient } from './perpetual/stream-client/stream-client';
25
+ export { PerpetualStreamConnection } from './perpetual/stream-client/perpetual-stream-connection';
26
+ export { BlockingTradingClient, TimedOpenOrderModel, TimedCancel } from './perpetual/simple-client/blocking-trading-client';
27
+ export { OrderBook, OrderBookEntry, ImpactDetails } from './perpetual/orderbook';
28
+ export { PositionModel, PositionHistoryModel, PositionSide, PositionStatus, ExitType } from './perpetual/positions';
29
+ export { AccountTradeModel, PublicTradeModel, TradeType } from './perpetual/trades';
30
+ export { createOrderObject, OrderTpslTriggerParam } from './perpetual/order-object';
31
+ export { MarketModel, MarketStatsModel, TradingConfigModel } from './perpetual/markets';
32
+ export { Asset, AssetOperationType, AssetOperationStatus } from './perpetual/assets';
33
+ export { TradingFeeModel, DEFAULT_FEES } from './perpetual/fees';
34
+ export { X10Error, RateLimitException, NotAuthorizedException, SubAccountExists } from './errors';
35
+ export { WrappedApiResponse, WrappedStreamResponse, StreamDataType } from './utils/http';
36
+ export { X10BaseModel, SettlementSignatureModel } from './utils/model';
37
+ export { generateNonce } from './utils/nonce';
38
+ export { utcNow, toEpochMillis } from './utils/date';
39
+ export * from './utils/env';
40
+ export { sign, pedersenHash, generateKeypairFromEthSignature, getOrderMsgHash, getTransferMsgHash, getWithdrawalMsgHash, } from './perpetual/crypto/signer';
41
+ export declare const SDK_VERSION = "0.0.1";
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3G,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,2CAA2C,EAC5C,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,iBAAiB,EACjB,eA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,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGxF,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGrF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGlG,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGrD,cAAc,aAAa,CAAC;AAG5B,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,+BAA+B,EAC/B,eAAe,EACf,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,WAAW,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ /**
3
+ * Extended TypeScript Trading SDK
4
+ *
5
+ * Unofficial TypeScript client for Extended Exchange API
6
+ * Built and maintained by the community
7
+ *
8
+ * Extended is a perpetual DEX, built by an ex-Revolut team.
9
+ * Extended offers perpetual contracts on both crypto and TradFi assets,
10
+ * with USDC as collateral and leverage of up to 100x.
11
+ */
12
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
+ desc = { enumerable: true, get: function() { return m[k]; } };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ o[k2] = m[k];
22
+ }));
23
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
24
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.OrderTpslTriggerParam = exports.createOrderObject = exports.TradeType = exports.PublicTradeModel = exports.AccountTradeModel = exports.ExitType = exports.PositionStatus = exports.PositionSide = exports.PositionHistoryModel = exports.PositionModel = exports.ImpactDetails = exports.OrderBookEntry = exports.OrderBook = exports.TimedCancel = exports.TimedOpenOrderModel = exports.BlockingTradingClient = exports.PerpetualStreamConnection = exports.PerpetualStreamClient = exports.StarkKeyPair = exports.UserClient = exports.TestnetModule = exports.InfoModule = exports.MarketsInformationModule = exports.OrderManagementModule = exports.AccountModule = exports.PerpetualTradingClient = exports.CreateOrderTpslTriggerModel = exports.OpenOrderModel = exports.PlacedOrderModel = exports.NewOrderModel = exports.OrderTriggerPriceType = exports.OrderPriceType = exports.SelfTradeProtectionLevel = exports.OrderTpslType = exports.TimeInForce = exports.OrderStatusReason = exports.OrderStatus = exports.OrderType = exports.OrderSide = exports.isCustomStarkSigner = exports.createStarkPerpetualAccountWithCustomSigner = exports.BalanceModel = exports.AccountLeverage = exports.AccountModel = exports.StarkPerpetualAccount = exports.MAINNET_CONFIG = exports.TESTNET_CONFIG = exports.StarknetDomain = exports.EndpointConfig = exports.initWasm = void 0;
28
+ exports.SDK_VERSION = exports.getWithdrawalMsgHash = exports.getTransferMsgHash = exports.getOrderMsgHash = exports.generateKeypairFromEthSignature = exports.pedersenHash = exports.sign = exports.toEpochMillis = exports.utcNow = exports.generateNonce = exports.SettlementSignatureModel = exports.X10BaseModel = exports.StreamDataType = exports.WrappedStreamResponse = exports.WrappedApiResponse = exports.SubAccountExists = exports.NotAuthorizedException = exports.RateLimitException = exports.X10Error = exports.DEFAULT_FEES = exports.TradingFeeModel = exports.AssetOperationStatus = exports.AssetOperationType = exports.Asset = exports.TradingConfigModel = exports.MarketStatsModel = exports.MarketModel = void 0;
29
+ // Initialize WASM module
30
+ var signer_1 = require("./perpetual/crypto/signer");
31
+ Object.defineProperty(exports, "initWasm", { enumerable: true, get: function () { return signer_1.initWasm; } });
32
+ // Configuration
33
+ var configuration_1 = require("./perpetual/configuration");
34
+ Object.defineProperty(exports, "EndpointConfig", { enumerable: true, get: function () { return configuration_1.EndpointConfig; } });
35
+ Object.defineProperty(exports, "StarknetDomain", { enumerable: true, get: function () { return configuration_1.StarknetDomain; } });
36
+ Object.defineProperty(exports, "TESTNET_CONFIG", { enumerable: true, get: function () { return configuration_1.TESTNET_CONFIG; } });
37
+ Object.defineProperty(exports, "MAINNET_CONFIG", { enumerable: true, get: function () { return configuration_1.MAINNET_CONFIG; } });
38
+ // Accounts
39
+ var accounts_1 = require("./perpetual/accounts");
40
+ Object.defineProperty(exports, "StarkPerpetualAccount", { enumerable: true, get: function () { return accounts_1.StarkPerpetualAccount; } });
41
+ Object.defineProperty(exports, "AccountModel", { enumerable: true, get: function () { return accounts_1.AccountModel; } });
42
+ Object.defineProperty(exports, "AccountLeverage", { enumerable: true, get: function () { return accounts_1.AccountLeverage; } });
43
+ Object.defineProperty(exports, "BalanceModel", { enumerable: true, get: function () { return accounts_1.BalanceModel; } });
44
+ Object.defineProperty(exports, "createStarkPerpetualAccountWithCustomSigner", { enumerable: true, get: function () { return accounts_1.createStarkPerpetualAccountWithCustomSigner; } });
45
+ // Custom Signer Support
46
+ var custom_signer_1 = require("./perpetual/custom-signer");
47
+ Object.defineProperty(exports, "isCustomStarkSigner", { enumerable: true, get: function () { return custom_signer_1.isCustomStarkSigner; } });
48
+ // Orders
49
+ var orders_1 = require("./perpetual/orders");
50
+ Object.defineProperty(exports, "OrderSide", { enumerable: true, get: function () { return orders_1.OrderSide; } });
51
+ Object.defineProperty(exports, "OrderType", { enumerable: true, get: function () { return orders_1.OrderType; } });
52
+ Object.defineProperty(exports, "OrderStatus", { enumerable: true, get: function () { return orders_1.OrderStatus; } });
53
+ Object.defineProperty(exports, "OrderStatusReason", { enumerable: true, get: function () { return orders_1.OrderStatusReason; } });
54
+ Object.defineProperty(exports, "TimeInForce", { enumerable: true, get: function () { return orders_1.TimeInForce; } });
55
+ Object.defineProperty(exports, "OrderTpslType", { enumerable: true, get: function () { return orders_1.OrderTpslType; } });
56
+ Object.defineProperty(exports, "SelfTradeProtectionLevel", { enumerable: true, get: function () { return orders_1.SelfTradeProtectionLevel; } });
57
+ Object.defineProperty(exports, "OrderPriceType", { enumerable: true, get: function () { return orders_1.OrderPriceType; } });
58
+ Object.defineProperty(exports, "OrderTriggerPriceType", { enumerable: true, get: function () { return orders_1.OrderTriggerPriceType; } });
59
+ Object.defineProperty(exports, "NewOrderModel", { enumerable: true, get: function () { return orders_1.NewOrderModel; } });
60
+ Object.defineProperty(exports, "PlacedOrderModel", { enumerable: true, get: function () { return orders_1.PlacedOrderModel; } });
61
+ Object.defineProperty(exports, "OpenOrderModel", { enumerable: true, get: function () { return orders_1.OpenOrderModel; } });
62
+ Object.defineProperty(exports, "CreateOrderTpslTriggerModel", { enumerable: true, get: function () { return orders_1.CreateOrderTpslTriggerModel; } });
63
+ // Trading Client
64
+ var trading_client_1 = require("./perpetual/trading-client/trading-client");
65
+ Object.defineProperty(exports, "PerpetualTradingClient", { enumerable: true, get: function () { return trading_client_1.PerpetualTradingClient; } });
66
+ var account_module_1 = require("./perpetual/trading-client/account-module");
67
+ Object.defineProperty(exports, "AccountModule", { enumerable: true, get: function () { return account_module_1.AccountModule; } });
68
+ var order_management_module_1 = require("./perpetual/trading-client/order-management-module");
69
+ Object.defineProperty(exports, "OrderManagementModule", { enumerable: true, get: function () { return order_management_module_1.OrderManagementModule; } });
70
+ var markets_information_module_1 = require("./perpetual/trading-client/markets-information-module");
71
+ Object.defineProperty(exports, "MarketsInformationModule", { enumerable: true, get: function () { return markets_information_module_1.MarketsInformationModule; } });
72
+ var info_module_1 = require("./perpetual/trading-client/info-module");
73
+ Object.defineProperty(exports, "InfoModule", { enumerable: true, get: function () { return info_module_1.InfoModule; } });
74
+ var testnet_module_1 = require("./perpetual/trading-client/testnet-module");
75
+ Object.defineProperty(exports, "TestnetModule", { enumerable: true, get: function () { return testnet_module_1.TestnetModule; } });
76
+ // User Client
77
+ var user_client_1 = require("./perpetual/user-client/user-client");
78
+ Object.defineProperty(exports, "UserClient", { enumerable: true, get: function () { return user_client_1.UserClient; } });
79
+ var onboarding_1 = require("./perpetual/user-client/onboarding");
80
+ Object.defineProperty(exports, "StarkKeyPair", { enumerable: true, get: function () { return onboarding_1.StarkKeyPair; } });
81
+ // Stream Client
82
+ var stream_client_1 = require("./perpetual/stream-client/stream-client");
83
+ Object.defineProperty(exports, "PerpetualStreamClient", { enumerable: true, get: function () { return stream_client_1.PerpetualStreamClient; } });
84
+ var perpetual_stream_connection_1 = require("./perpetual/stream-client/perpetual-stream-connection");
85
+ Object.defineProperty(exports, "PerpetualStreamConnection", { enumerable: true, get: function () { return perpetual_stream_connection_1.PerpetualStreamConnection; } });
86
+ // Simple Client Utilities
87
+ var blocking_trading_client_1 = require("./perpetual/simple-client/blocking-trading-client");
88
+ Object.defineProperty(exports, "BlockingTradingClient", { enumerable: true, get: function () { return blocking_trading_client_1.BlockingTradingClient; } });
89
+ Object.defineProperty(exports, "TimedOpenOrderModel", { enumerable: true, get: function () { return blocking_trading_client_1.TimedOpenOrderModel; } });
90
+ Object.defineProperty(exports, "TimedCancel", { enumerable: true, get: function () { return blocking_trading_client_1.TimedCancel; } });
91
+ var orderbook_1 = require("./perpetual/orderbook");
92
+ Object.defineProperty(exports, "OrderBook", { enumerable: true, get: function () { return orderbook_1.OrderBook; } });
93
+ Object.defineProperty(exports, "OrderBookEntry", { enumerable: true, get: function () { return orderbook_1.OrderBookEntry; } });
94
+ Object.defineProperty(exports, "ImpactDetails", { enumerable: true, get: function () { return orderbook_1.ImpactDetails; } });
95
+ // Positions & Trades
96
+ var positions_1 = require("./perpetual/positions");
97
+ Object.defineProperty(exports, "PositionModel", { enumerable: true, get: function () { return positions_1.PositionModel; } });
98
+ Object.defineProperty(exports, "PositionHistoryModel", { enumerable: true, get: function () { return positions_1.PositionHistoryModel; } });
99
+ Object.defineProperty(exports, "PositionSide", { enumerable: true, get: function () { return positions_1.PositionSide; } });
100
+ Object.defineProperty(exports, "PositionStatus", { enumerable: true, get: function () { return positions_1.PositionStatus; } });
101
+ Object.defineProperty(exports, "ExitType", { enumerable: true, get: function () { return positions_1.ExitType; } });
102
+ var trades_1 = require("./perpetual/trades");
103
+ Object.defineProperty(exports, "AccountTradeModel", { enumerable: true, get: function () { return trades_1.AccountTradeModel; } });
104
+ Object.defineProperty(exports, "PublicTradeModel", { enumerable: true, get: function () { return trades_1.PublicTradeModel; } });
105
+ Object.defineProperty(exports, "TradeType", { enumerable: true, get: function () { return trades_1.TradeType; } });
106
+ // Order Objects
107
+ var order_object_1 = require("./perpetual/order-object");
108
+ Object.defineProperty(exports, "createOrderObject", { enumerable: true, get: function () { return order_object_1.createOrderObject; } });
109
+ Object.defineProperty(exports, "OrderTpslTriggerParam", { enumerable: true, get: function () { return order_object_1.OrderTpslTriggerParam; } });
110
+ // Markets
111
+ var markets_1 = require("./perpetual/markets");
112
+ Object.defineProperty(exports, "MarketModel", { enumerable: true, get: function () { return markets_1.MarketModel; } });
113
+ Object.defineProperty(exports, "MarketStatsModel", { enumerable: true, get: function () { return markets_1.MarketStatsModel; } });
114
+ Object.defineProperty(exports, "TradingConfigModel", { enumerable: true, get: function () { return markets_1.TradingConfigModel; } });
115
+ // Assets
116
+ var assets_1 = require("./perpetual/assets");
117
+ Object.defineProperty(exports, "Asset", { enumerable: true, get: function () { return assets_1.Asset; } });
118
+ Object.defineProperty(exports, "AssetOperationType", { enumerable: true, get: function () { return assets_1.AssetOperationType; } });
119
+ Object.defineProperty(exports, "AssetOperationStatus", { enumerable: true, get: function () { return assets_1.AssetOperationStatus; } });
120
+ // Fees
121
+ var fees_1 = require("./perpetual/fees");
122
+ Object.defineProperty(exports, "TradingFeeModel", { enumerable: true, get: function () { return fees_1.TradingFeeModel; } });
123
+ Object.defineProperty(exports, "DEFAULT_FEES", { enumerable: true, get: function () { return fees_1.DEFAULT_FEES; } });
124
+ // Errors
125
+ var errors_1 = require("./errors");
126
+ Object.defineProperty(exports, "X10Error", { enumerable: true, get: function () { return errors_1.X10Error; } });
127
+ Object.defineProperty(exports, "RateLimitException", { enumerable: true, get: function () { return errors_1.RateLimitException; } });
128
+ Object.defineProperty(exports, "NotAuthorizedException", { enumerable: true, get: function () { return errors_1.NotAuthorizedException; } });
129
+ Object.defineProperty(exports, "SubAccountExists", { enumerable: true, get: function () { return errors_1.SubAccountExists; } });
130
+ // Utils
131
+ var http_1 = require("./utils/http");
132
+ Object.defineProperty(exports, "WrappedApiResponse", { enumerable: true, get: function () { return http_1.WrappedApiResponse; } });
133
+ Object.defineProperty(exports, "WrappedStreamResponse", { enumerable: true, get: function () { return http_1.WrappedStreamResponse; } });
134
+ Object.defineProperty(exports, "StreamDataType", { enumerable: true, get: function () { return http_1.StreamDataType; } });
135
+ var model_1 = require("./utils/model");
136
+ Object.defineProperty(exports, "X10BaseModel", { enumerable: true, get: function () { return model_1.X10BaseModel; } });
137
+ Object.defineProperty(exports, "SettlementSignatureModel", { enumerable: true, get: function () { return model_1.SettlementSignatureModel; } });
138
+ var nonce_1 = require("./utils/nonce");
139
+ Object.defineProperty(exports, "generateNonce", { enumerable: true, get: function () { return nonce_1.generateNonce; } });
140
+ var date_1 = require("./utils/date");
141
+ Object.defineProperty(exports, "utcNow", { enumerable: true, get: function () { return date_1.utcNow; } });
142
+ Object.defineProperty(exports, "toEpochMillis", { enumerable: true, get: function () { return date_1.toEpochMillis; } });
143
+ // Utils
144
+ __exportStar(require("./utils/env"), exports);
145
+ // Cryptographic Signer Functions (exported for standalone use)
146
+ var signer_2 = require("./perpetual/crypto/signer");
147
+ Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return signer_2.sign; } });
148
+ Object.defineProperty(exports, "pedersenHash", { enumerable: true, get: function () { return signer_2.pedersenHash; } });
149
+ Object.defineProperty(exports, "generateKeypairFromEthSignature", { enumerable: true, get: function () { return signer_2.generateKeypairFromEthSignature; } });
150
+ Object.defineProperty(exports, "getOrderMsgHash", { enumerable: true, get: function () { return signer_2.getOrderMsgHash; } });
151
+ Object.defineProperty(exports, "getTransferMsgHash", { enumerable: true, get: function () { return signer_2.getTransferMsgHash; } });
152
+ Object.defineProperty(exports, "getWithdrawalMsgHash", { enumerable: true, get: function () { return signer_2.getWithdrawalMsgHash; } });
153
+ // Version
154
+ exports.SDK_VERSION = '0.0.1';
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;AAEH,yBAAyB;AACzB,oDAAqD;AAA5C,kGAAA,QAAQ,OAAA;AAEjB,gBAAgB;AAChB,2DAA2G;AAAlG,+GAAA,cAAc,OAAA;AAAE,+GAAA,cAAc,OAAA;AAAE,+GAAA,cAAc,OAAA;AAAE,+GAAA,cAAc,OAAA;AAEvE,WAAW;AACX,iDAM8B;AAL5B,iHAAA,qBAAqB,OAAA;AACrB,wGAAA,YAAY,OAAA;AACZ,2GAAA,eAAe,OAAA;AACf,wGAAA,YAAY,OAAA;AACZ,uIAAA,2CAA2C,OAAA;AAG7C,wBAAwB;AACxB,2DAImC;AADjC,oHAAA,mBAAmB,OAAA;AAGrB,SAAS;AACT,6CAc4B;AAb1B,mGAAA,SAAS,OAAA;AACT,mGAAA,SAAS,OAAA;AACT,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AACjB,qGAAA,WAAW,OAAA;AACX,uGAAA,aAAa,OAAA;AACb,kHAAA,wBAAwB,OAAA;AACxB,wGAAA,cAAc,OAAA;AACd,+GAAA,qBAAqB,OAAA;AACrB,uGAAA,aAAa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qF;AAA5E,+FAAA,KAAK,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAAE,8GAAA,oBAAoB,OAAA;AAExD,OAAO;AACP,yCAAiE;AAAxD,uGAAA,eAAe,OAAA;AAAE,oGAAA,YAAY,OAAA;AAEtC,SAAS;AACT,mCAAkG;AAAzF,kGAAA,QAAQ,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAE/E,QAAQ;AACR,qCAAyF;AAAhF,0GAAA,kBAAkB,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAAE,sGAAA,cAAc,OAAA;AAClE,uCAAuE;AAA9D,qGAAA,YAAY,OAAA;AAAE,iHAAA,wBAAwB,OAAA;AAC/C,uCAA8C;AAArC,sGAAA,aAAa,OAAA;AACtB,qCAAqD;AAA5C,8FAAA,MAAM,OAAA;AAAE,qGAAA,aAAa,OAAA;AAE9B,QAAQ;AACR,8CAA4B;AAE5B,+DAA+D;AAC/D,oDAOmC;AANjC,8FAAA,IAAI,OAAA;AACJ,sGAAA,YAAY,OAAA;AACZ,yHAAA,+BAA+B,OAAA;AAC/B,yGAAA,eAAe,OAAA;AACf,4GAAA,kBAAkB,OAAA;AAClB,8GAAA,oBAAoB,OAAA;AAGtB,UAAU;AACG,QAAA,WAAW,GAAG,OAAO,CAAC"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Account models and StarkPerpetualAccount class
3
+ */
4
+ import Decimal from 'decimal.js';
5
+ import { X10BaseModel } from '../utils/model';
6
+ import { CustomStarkSigner } from './custom-signer';
7
+ /**
8
+ * Stark Perpetual Account
9
+ * Manages signing operations for trading
10
+ *
11
+ * Supports two modes of operation:
12
+ * 1. Direct signing with a private key (default)
13
+ * 2. Custom signer integration (e.g., Privy, Web3Auth)
14
+ */
15
+ export declare class StarkPerpetualAccount {
16
+ private vault;
17
+ private privateKey?;
18
+ private publicKey;
19
+ private apiKey;
20
+ private tradingFee;
21
+ private customSigner?;
22
+ constructor(vault: number | string, privateKey: string, publicKey: string, apiKey: string);
23
+ getVault(): number;
24
+ getPublicKey(): bigint;
25
+ getPublicKeyHex(): string;
26
+ getApiKey(): string;
27
+ getTradingFee(): Map<string, any>;
28
+ setTradingFee(market: string, fee: any): void;
29
+ /**
30
+ * Set a custom signer for remote signing (e.g., Privy, Web3Auth)
31
+ *
32
+ * @param signer - Custom signer implementation
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const account = new StarkPerpetualAccount(vault, privateKey, publicKey, apiKey);
37
+ * account.setCustomSigner(new PrivyStarkSigner(privyClient, walletId));
38
+ * ```
39
+ */
40
+ setCustomSigner(signer: CustomStarkSigner): void;
41
+ /**
42
+ * Get the custom signer if set
43
+ */
44
+ getCustomSigner(): CustomStarkSigner | undefined;
45
+ /**
46
+ * Clear the custom signer and use direct signing
47
+ */
48
+ clearCustomSigner(): void;
49
+ /**
50
+ * Sign a message hash
51
+ * Returns Promise resolving to [r, s] tuple
52
+ *
53
+ * If a custom signer is set, uses the custom signer.
54
+ * Otherwise, uses the built-in WASM signer with the private key.
55
+ *
56
+ * @returns Promise resolving to signature tuple [r, s]
57
+ */
58
+ sign(msgHash: bigint): Promise<[bigint, bigint]>;
59
+ }
60
+ /**
61
+ * Create a StarkPerpetualAccount with a custom signer
62
+ *
63
+ * Use this factory function when integrating with external signing services
64
+ * like Privy, Web3Auth, or other remote signers that don't expose private keys.
65
+ *
66
+ * Note: This function uses a dummy private key internally to maintain backward
67
+ * compatibility with the existing StarkPerpetualAccount constructor. The dummy
68
+ * key is never used for signing when a custom signer is set.
69
+ *
70
+ * @param vault - Vault ID
71
+ * @param publicKey - Public key as hex string
72
+ * @param apiKey - API key for authentication
73
+ * @param customSigner - Custom signer implementation
74
+ * @returns StarkPerpetualAccount configured with the custom signer
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const privySigner = new PrivyStarkSigner(privyClient, walletId);
79
+ * const account = createStarkPerpetualAccountWithCustomSigner(
80
+ * vaultId,
81
+ * publicKeyHex,
82
+ * apiKey,
83
+ * privySigner
84
+ * );
85
+ * ```
86
+ */
87
+ export declare function createStarkPerpetualAccountWithCustomSigner(vault: number | string, publicKey: string, apiKey: string, customSigner: CustomStarkSigner): StarkPerpetualAccount;
88
+ /**
89
+ * Account model
90
+ */
91
+ export declare class AccountModel extends X10BaseModel {
92
+ accountId: number;
93
+ description: string;
94
+ accountIndex: number;
95
+ status: string;
96
+ l2Key: string;
97
+ l2Vault: number;
98
+ bridgeStarknetAddress?: string;
99
+ apiKeys?: string[];
100
+ constructor(accountId: number, description: string, accountIndex: number, status: string, l2Key: string, l2Vault: number, bridgeStarknetAddress?: string, apiKeys?: string[]);
101
+ }
102
+ /**
103
+ * Account leverage model
104
+ */
105
+ export declare class AccountLeverage extends X10BaseModel {
106
+ market: string;
107
+ leverage: Decimal;
108
+ constructor(market: string, leverage: Decimal);
109
+ }
110
+ /**
111
+ * API key response model
112
+ */
113
+ export declare class ApiKeyResponseModel extends X10BaseModel {
114
+ key: string;
115
+ constructor(key: string);
116
+ }
117
+ /**
118
+ * API key request model
119
+ */
120
+ export declare class ApiKeyRequestModel extends X10BaseModel {
121
+ description: string;
122
+ constructor(description: string);
123
+ }
124
+ /**
125
+ * Balance model
126
+ */
127
+ export declare class BalanceModel extends X10BaseModel {
128
+ collateralName: string;
129
+ balance: Decimal;
130
+ equity: Decimal;
131
+ availableForTrade: Decimal;
132
+ availableForWithdrawal: Decimal;
133
+ unrealisedPnl: Decimal;
134
+ initialMargin: Decimal;
135
+ marginRatio: Decimal;
136
+ updatedTime: number;
137
+ }
138
+ /**
139
+ * Account stream data model
140
+ */
141
+ export declare class AccountStreamDataModel extends X10BaseModel {
142
+ orders?: any[];
143
+ positions?: any[];
144
+ trades?: any[];
145
+ balance?: BalanceModel;
146
+ }
147
+ //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/perpet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ACrB;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB"}
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ /**
3
+ * Account models and StarkPerpetualAccount class
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AccountStreamDataModel = exports.BalanceModel = exports.ApiKeyRequestModel = exports.ApiKeyResponseModel = exports.AccountLeverage = exports.AccountModel = exports.StarkPerpetualAccount = void 0;
7
+ exports.createStarkPerpetualAccountWithCustomSigner = createStarkPerpetualAccountWithCustomSigner;
8
+ const model_1 = require("../utils/model");
9
+ const string_1 = require("../utils/string");
10
+ const signer_1 = require("./crypto/signer");
11
+ const custom_signer_1 = require("./custom-signer");
12
+ /**
13
+ * Stark Perpetual Account
14
+ * Manages signing operations for trading
15
+ *
16
+ * Supports two modes of operation:
17
+ * 1. Direct signing with a private key (default)
18
+ * 2. Custom signer integration (e.g., Privy, Web3Auth)
19
+ */
20
+ class StarkPerpetualAccount {
21
+ vault;
22
+ privateKey;
23
+ publicKey;
24
+ apiKey;
25
+ tradingFee = new Map();
26
+ customSigner;
27
+ constructor(vault, privateKey, publicKey, apiKey) {
28
+ if (!(0, string_1.isHexString)(privateKey)) {
29
+ throw new Error('Invalid private key format');
30
+ }
31
+ if (!(0, string_1.isHexString)(publicKey)) {
32
+ throw new Error('Invalid public key format');
33
+ }
34
+ if (typeof vault === 'string') {
35
+ this.vault = parseInt(vault, 10);
36
+ }
37
+ else {
38
+ this.vault = vault;
39
+ }
40
+ // Remove '0x' prefix if present and convert to bigint
41
+ const cleanPrivateKey = privateKey.startsWith('0x') ? privateKey.slice(2) : privateKey;
42
+ const cleanPublicKey = publicKey.startsWith('0x') ? publicKey.slice(2) : publicKey;
43
+ this.privateKey = BigInt('0x' + cleanPrivateKey);
44
+ this.publicKey = BigInt('0x' + cleanPublicKey);
45
+ this.apiKey = apiKey;
46
+ }
47
+ getVault() {
48
+ return this.vault;
49
+ }
50
+ getPublicKey() {
51
+ return this.publicKey;
52
+ }
53
+ getPublicKeyHex() {
54
+ return '0x' + this.publicKey.toString(16);
55
+ }
56
+ getApiKey() {
57
+ return this.apiKey;
58
+ }
59
+ getTradingFee() {
60
+ return this.tradingFee;
61
+ }
62
+ setTradingFee(market, fee) {
63
+ this.tradingFee.set(market, fee);
64
+ }
65
+ /**
66
+ * Set a custom signer for remote signing (e.g., Privy, Web3Auth)
67
+ *
68
+ * @param signer - Custom signer implementation
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const account = new StarkPerpetualAccount(vault, privateKey, publicKey, apiKey);
73
+ * account.setCustomSigner(new PrivyStarkSigner(privyClient, walletId));
74
+ * ```
75
+ */
76
+ setCustomSigner(signer) {
77
+ if (!(0, custom_signer_1.isCustomStarkSigner)(signer)) {
78
+ throw new Error('Invalid custom signer: must implement CustomStarkSigner interface');
79
+ }
80
+ this.customSigner = signer;
81
+ }
82
+ /**
83
+ * Get the custom signer if set
84
+ */
85
+ getCustomSigner() {
86
+ return this.customSigner;
87
+ }
88
+ /**
89
+ * Clear the custom signer and use direct signing
90
+ */
91
+ clearCustomSigner() {
92
+ this.customSigner = undefined;
93
+ }
94
+ /**
95
+ * Sign a message hash
96
+ * Returns Promise resolving to [r, s] tuple
97
+ *
98
+ * If a custom signer is set, uses the custom signer.
99
+ * Otherwise, uses the built-in WASM signer with the private key.
100
+ *
101
+ * @returns Promise resolving to signature tuple [r, s]
102
+ */
103
+ async sign(msgHash) {
104
+ if (this.customSigner) {
105
+ return this.customSigner.sign(msgHash);
106
+ }
107
+ if (!this.privateKey) {
108
+ throw new Error('No private key or custom signer available for signing');
109
+ }
110
+ // Wrap synchronous WASM sign in Promise for consistent API
111
+ return Promise.resolve((0, signer_1.sign)(this.privateKey, msgHash));
112
+ }
113
+ }
114
+ exports.StarkPerpetualAccount = StarkPerpetualAccount;
115
+ /**
116
+ * Create a StarkPerpetualAccount with a custom signer
117
+ *
118
+ * Use this factory function when integrating with external signing services
119
+ * like Privy, Web3Auth, or other remote signers that don't expose private keys.
120
+ *
121
+ * Note: This function uses a dummy private key internally to maintain backward
122
+ * compatibility with the existing StarkPerpetualAccount constructor. The dummy
123
+ * key is never used for signing when a custom signer is set.
124
+ *
125
+ * @param vault - Vault ID
126
+ * @param publicKey - Public key as hex string
127
+ * @param apiKey - API key for authentication
128
+ * @param customSigner - Custom signer implementation
129
+ * @returns StarkPerpetualAccount configured with the custom signer
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * const privySigner = new PrivyStarkSigner(privyClient, walletId);
134
+ * const account = createStarkPerpetualAccountWithCustomSigner(
135
+ * vaultId,
136
+ * publicKeyHex,
137
+ * apiKey,
138
+ * privySigner
139
+ * );
140
+ * ```
141
+ */
142
+ function createStarkPerpetualAccountWithCustomSigner(vault, publicKey, apiKey, customSigner) {
143
+ // Use a dummy private key (all zeros) to satisfy the constructor
144
+ // This maintains backward compatibility without breaking existing code
145
+ // The dummy key is never used when a custom signer is set
146
+ const dummyPrivateKey = '0x0000000000000000000000000000000000000000000000000000000000000000';
147
+ const account = new StarkPerpetualAccount(vault, dummyPrivateKey, publicKey, apiKey);
148
+ account.setCustomSigner(customSigner);
149
+ return account;
150
+ }
151
+ /**
152
+ * Account model
153
+ */
154
+ class AccountModel extends model_1.X10BaseModel {
155
+ accountId;
156
+ description;
157
+ accountIndex;
158
+ status;
159
+ l2Key;
160
+ l2Vault;
161
+ bridgeStarknetAddress;
162
+ apiKeys;
163
+ constructor(accountId, description, accountIndex, status, l2Key, l2Vault, bridgeStarknetAddress, apiKeys) {
164
+ super();
165
+ this.accountId = accountId;
166
+ this.description = description;
167
+ this.accountIndex = accountIndex;
168
+ this.status = status;
169
+ this.l2Key = l2Key;
170
+ this.l2Vault = l2Vault;
171
+ this.bridgeStarknetAddress = bridgeStarknetAddress;
172
+ this.apiKeys = apiKeys;
173
+ }
174
+ }
175
+ exports.AccountModel = AccountModel;
176
+ /**
177
+ * Account leverage model
178
+ */
179
+ class AccountLeverage extends model_1.X10BaseModel {
180
+ market;
181
+ leverage;
182
+ constructor(market, leverage) {
183
+ super();
184
+ this.market = market;
185
+ this.leverage = leverage;
186
+ }
187
+ }
188
+ exports.AccountLeverage = AccountLeverage;
189
+ /**
190
+ * API key response model
191
+ */
192
+ class ApiKeyResponseModel extends model_1.X10BaseModel {
193
+ key;
194
+ constructor(key) {
195
+ super();
196
+ this.key = key;
197
+ }
198
+ }
199
+ exports.ApiKeyResponseModel = ApiKeyResponseModel;
200
+ /**
201
+ * API key request model
202
+ */
203
+ class ApiKeyRequestModel extends model_1.X10BaseModel {
204
+ description;
205
+ constructor(description) {
206
+ super();
207
+ this.description = description;
208
+ }
209
+ }
210
+ exports.ApiKeyRequestModel = ApiKeyRequestModel;
211
+ /**
212
+ * Balance model
213
+ */
214
+ class BalanceModel extends model_1.X10BaseModel {
215
+ collateralName;
216
+ balance;
217
+ equity;
218
+ availableForTrade;
219
+ availableForWithdrawal;
220
+ unrealisedPnl;
221
+ initialMargin;
222
+ marginRatio;
223
+ updatedTime;
224
+ }
225
+ exports.BalanceModel = BalanceModel;
226
+ /**
227
+ * Account stream data model
228
+ */
229
+ class AccountStreamDataModel extends model_1.X10BaseModel {
230
+ orders;
231
+ positions;
232
+ trades;
233
+ balance;
234
+ }
235
+ exports.AccountStreamDataModel = AccountStreamDataModel;
236
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/perpetual/accounts.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAyJH,kGAaC;AAnKD,0CAA8C;AAC9C,4CAA8C;AAC9C,4CAAmD;AACnD,mDAAyE;AAEzE;;;;;;;GAOG;AACH,MAAa,qBAAqB;IACxB,KAAK,CAAS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AC3B,CAAC;CACF;AATD,0CASC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,oBAAY;IACnD,GAAG,CAAS;IAEZ,YAAY,GAAW;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;CACF;AAPD,kDAOC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,oBAAY;IAClD,WAAW,CAAS;IAEpB,YAAY,WAAmB;QAC7B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAPD,gDAOC;AAED;;GAEG;AACH,MAAa,YAAa,SAAQ,oBAAY;IAC5C,cAAc,CAAS;IACvB,OAAO,CAAU;IACjB,MAAM,CAAU;IAChB,iBAAiB,CAAU;IAC3B,sBAAsB,CAAU;IAChC,aAAa,CAAU;IACvB,aAAa,CAAU;IACvB,WAAW,CAAU;IACrB,WAAW,CAAS;CACrB;AAVD,oCAUC;AAED;;GAEG;AACH,MAAa,sBAAuB,SAAQ,oBAAY;IACtD,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,MAAM,CAAS;IACf,OAAO,CAAgB;CACxB;AALD,wDAKC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Amount conversion utilities
3
+ */
4
+ import Decimal from 'decimal.js';
5
+ import { Asset } from './assets';
6
+ /**
7
+ * Rounding contexts
8
+ */
9
+ export declare const ROUNDING_SELL_CONTEXT: 1;
10
+ export declare const ROUNDING_BUY_CONTEXT: 0;
11
+ export declare const ROUNDING_FEE_CONTEXT: 0;
12
+ /**
13
+ * Human-readable amount
14
+ */
15
+ export declare class HumanReadableAmount {
16
+ value: Decimal;
17
+ asset: Asset;
18
+ constructor(value: Decimal, asset: Asset);
19
+ toL1Amount(): L1Amount;
20
+ toStarkAmount(roundingMode?: Decimal.Rounding): StarkAmount;
21
+ }
22
+ /**
23
+ * L1 amount
24
+ */
25
+ export declare class L1Amount {
26
+ value: number;
27
+ asset: Asset;
28
+ constructor(value: number, asset: Asset);
29
+ toInternalAmount(): HumanReadableAmount;
30
+ }
31
+ /**
32
+ * Stark amount
33
+ */
34
+ export declare class StarkAmount {
35
+ value: number;
36
+ asset: Asset;
37
+ constructor(value: number, asset: Asset);
38
+ toInternalAmount(): HumanReadableAmount;
39
+ negate(): StarkAmount;
40
+ }
41
+ //# sourceMappingURL=amounts.d.ts.map