@lifi/perps-types 0.1.1-alpha.9 → 1.0.0

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 (282) hide show
  1. package/README.md +6 -30
  2. package/dist/cjs/acceptTerms.d.ts +20 -0
  3. package/dist/cjs/acceptTerms.d.ts.map +1 -0
  4. package/dist/cjs/acceptTerms.js +10 -0
  5. package/dist/cjs/acceptTerms.js.map +1 -0
  6. package/dist/cjs/account.d.ts +191 -0
  7. package/dist/cjs/account.d.ts.map +1 -0
  8. package/{src/_esm → dist/cjs}/account.js.map +1 -1
  9. package/dist/cjs/action.d.ts +200 -0
  10. package/dist/cjs/action.d.ts.map +1 -0
  11. package/dist/cjs/action.js +3 -0
  12. package/dist/cjs/action.js.map +1 -0
  13. package/dist/cjs/asset.d.ts +11 -0
  14. package/dist/cjs/asset.d.ts.map +1 -0
  15. package/{src/_cjs/providers/hyperliquid/types.js → dist/cjs/asset.js} +1 -1
  16. package/dist/cjs/asset.js.map +1 -0
  17. package/dist/cjs/enums.d.ts +148 -0
  18. package/dist/cjs/enums.d.ts.map +1 -0
  19. package/dist/cjs/enums.js +170 -0
  20. package/dist/cjs/enums.js.map +1 -0
  21. package/dist/cjs/errors.d.ts.map +1 -0
  22. package/dist/cjs/errors.js.map +1 -0
  23. package/dist/cjs/index.d.ts +15 -0
  24. package/dist/cjs/index.d.ts.map +1 -0
  25. package/{src/_cjs → dist/cjs}/index.js +11 -6
  26. package/dist/cjs/index.js.map +1 -0
  27. package/{src/_types → dist/cjs}/market.d.ts +33 -36
  28. package/dist/cjs/market.d.ts.map +1 -0
  29. package/dist/cjs/market.js.map +1 -0
  30. package/dist/cjs/meta.d.ts +17 -0
  31. package/dist/cjs/meta.d.ts.map +1 -0
  32. package/dist/cjs/meta.js +3 -0
  33. package/dist/cjs/meta.js.map +1 -0
  34. package/dist/cjs/primitives.d.ts +3 -0
  35. package/dist/cjs/primitives.d.ts.map +1 -0
  36. package/dist/cjs/primitives.js +3 -0
  37. package/dist/cjs/primitives.js.map +1 -0
  38. package/dist/cjs/providers.d.ts +58 -0
  39. package/dist/cjs/providers.d.ts.map +1 -0
  40. package/dist/cjs/providers.js +3 -0
  41. package/dist/cjs/providers.js.map +1 -0
  42. package/dist/cjs/quote.d.ts +23 -0
  43. package/dist/cjs/quote.d.ts.map +1 -0
  44. package/dist/cjs/quote.js +3 -0
  45. package/dist/cjs/quote.js.map +1 -0
  46. package/{src/_types → dist/cjs}/subscriptions.d.ts +26 -20
  47. package/dist/cjs/subscriptions.d.ts.map +1 -0
  48. package/{src/_cjs → dist/cjs}/subscriptions.js.map +1 -1
  49. package/dist/cjs/typedData.d.ts +23 -0
  50. package/dist/cjs/typedData.d.ts.map +1 -0
  51. package/{src/_cjs → dist/cjs}/typedData.js.map +1 -1
  52. package/dist/cjs/vote.d.ts +27 -0
  53. package/dist/cjs/vote.d.ts.map +1 -0
  54. package/dist/cjs/vote.js +12 -0
  55. package/dist/cjs/vote.js.map +1 -0
  56. package/dist/esm/acceptTerms.d.ts +45 -0
  57. package/dist/esm/acceptTerms.d.ts.map +1 -0
  58. package/dist/esm/acceptTerms.js +12 -0
  59. package/dist/esm/acceptTerms.js.map +1 -0
  60. package/dist/esm/account.d.ts +229 -0
  61. package/dist/esm/account.d.ts.map +1 -0
  62. package/{src/_cjs → dist/esm}/account.js.map +1 -1
  63. package/dist/esm/action.d.ts +248 -0
  64. package/dist/esm/action.d.ts.map +1 -0
  65. package/dist/esm/action.js +2 -0
  66. package/dist/esm/action.js.map +1 -0
  67. package/dist/esm/asset.d.ts +25 -0
  68. package/dist/esm/asset.d.ts.map +1 -0
  69. package/dist/esm/asset.js +2 -0
  70. package/dist/esm/asset.js.map +1 -0
  71. package/dist/esm/enums.d.ts +171 -0
  72. package/dist/esm/enums.d.ts.map +1 -0
  73. package/dist/esm/enums.js +195 -0
  74. package/dist/esm/enums.js.map +1 -0
  75. package/dist/esm/errors.d.ts +8 -0
  76. package/dist/esm/errors.d.ts.map +1 -0
  77. package/dist/esm/errors.js.map +1 -0
  78. package/dist/esm/index.d.ts +23 -0
  79. package/dist/esm/index.d.ts.map +1 -0
  80. package/dist/esm/index.js +23 -0
  81. package/dist/esm/index.js.map +1 -0
  82. package/dist/esm/market.d.ts +107 -0
  83. package/dist/esm/market.d.ts.map +1 -0
  84. package/dist/esm/market.js.map +1 -0
  85. package/dist/esm/meta.d.ts +37 -0
  86. package/dist/esm/meta.d.ts.map +1 -0
  87. package/dist/esm/meta.js +2 -0
  88. package/dist/esm/meta.js.map +1 -0
  89. package/dist/esm/primitives.d.ts +5 -0
  90. package/dist/esm/primitives.d.ts.map +1 -0
  91. package/dist/esm/primitives.js +2 -0
  92. package/dist/esm/primitives.js.map +1 -0
  93. package/dist/esm/providers.d.ts +116 -0
  94. package/dist/esm/providers.d.ts.map +1 -0
  95. package/dist/esm/providers.js +2 -0
  96. package/dist/esm/providers.js.map +1 -0
  97. package/dist/esm/quote.d.ts +47 -0
  98. package/dist/esm/quote.d.ts.map +1 -0
  99. package/dist/esm/quote.js +2 -0
  100. package/dist/esm/quote.js.map +1 -0
  101. package/dist/esm/subscriptions.d.ts +115 -0
  102. package/dist/esm/subscriptions.d.ts.map +1 -0
  103. package/{src/_esm → dist/esm}/subscriptions.js.map +1 -1
  104. package/dist/esm/typedData.d.ts +28 -0
  105. package/dist/esm/typedData.d.ts.map +1 -0
  106. package/{src/_esm → dist/esm}/typedData.js.map +1 -1
  107. package/dist/esm/vote.d.ts +68 -0
  108. package/dist/esm/vote.d.ts.map +1 -0
  109. package/dist/esm/vote.js +20 -0
  110. package/dist/esm/vote.js.map +1 -0
  111. package/dist/types/acceptTerms.d.ts +45 -0
  112. package/dist/types/acceptTerms.d.ts.map +1 -0
  113. package/dist/types/account.d.ts +229 -0
  114. package/dist/types/account.d.ts.map +1 -0
  115. package/dist/types/action.d.ts +248 -0
  116. package/dist/types/action.d.ts.map +1 -0
  117. package/dist/types/asset.d.ts +25 -0
  118. package/dist/types/asset.d.ts.map +1 -0
  119. package/dist/types/enums.d.ts +171 -0
  120. package/dist/types/enums.d.ts.map +1 -0
  121. package/dist/types/errors.d.ts +8 -0
  122. package/dist/types/errors.d.ts.map +1 -0
  123. package/dist/types/index.d.ts +23 -0
  124. package/dist/types/index.d.ts.map +1 -0
  125. package/dist/types/market.d.ts +107 -0
  126. package/dist/types/market.d.ts.map +1 -0
  127. package/dist/types/meta.d.ts +37 -0
  128. package/dist/types/meta.d.ts.map +1 -0
  129. package/dist/types/primitives.d.ts +5 -0
  130. package/dist/types/primitives.d.ts.map +1 -0
  131. package/dist/types/providers.d.ts +116 -0
  132. package/dist/types/providers.d.ts.map +1 -0
  133. package/dist/types/quote.d.ts +47 -0
  134. package/dist/types/quote.d.ts.map +1 -0
  135. package/dist/types/subscriptions.d.ts +115 -0
  136. package/dist/types/subscriptions.d.ts.map +1 -0
  137. package/dist/types/typedData.d.ts +28 -0
  138. package/dist/types/typedData.d.ts.map +1 -0
  139. package/dist/types/vote.d.ts +68 -0
  140. package/dist/types/vote.d.ts.map +1 -0
  141. package/package.json +37 -51
  142. package/src/acceptTerms.ts +53 -0
  143. package/src/account.ts +163 -29
  144. package/src/action.ts +292 -0
  145. package/src/asset.ts +25 -0
  146. package/src/enums.ts +102 -3
  147. package/src/errors.ts +1 -0
  148. package/src/index.ts +20 -6
  149. package/src/market.ts +79 -39
  150. package/src/meta.ts +38 -0
  151. package/src/primitives.ts +5 -0
  152. package/src/providers.ts +122 -0
  153. package/src/quote.ts +49 -0
  154. package/src/subscriptions.ts +70 -25
  155. package/src/typedData.ts +27 -8
  156. package/src/vote.ts +79 -0
  157. package/providers/hyperliquid/package.json +0 -5
  158. package/src/_cjs/authorization.js +0 -3
  159. package/src/_cjs/authorization.js.map +0 -1
  160. package/src/_cjs/enums.js +0 -100
  161. package/src/_cjs/enums.js.map +0 -1
  162. package/src/_cjs/errors.js.map +0 -1
  163. package/src/_cjs/index.js.map +0 -1
  164. package/src/_cjs/market.js.map +0 -1
  165. package/src/_cjs/providers/hyperliquid/assetId.js +0 -19
  166. package/src/_cjs/providers/hyperliquid/assetId.js.map +0 -1
  167. package/src/_cjs/providers/hyperliquid/index.js +0 -20
  168. package/src/_cjs/providers/hyperliquid/index.js.map +0 -1
  169. package/src/_cjs/providers/hyperliquid/mappers/activity.js +0 -56
  170. package/src/_cjs/providers/hyperliquid/mappers/activity.js.map +0 -1
  171. package/src/_cjs/providers/hyperliquid/mappers/history.js +0 -22
  172. package/src/_cjs/providers/hyperliquid/mappers/history.js.map +0 -1
  173. package/src/_cjs/providers/hyperliquid/mappers/index.js +0 -18
  174. package/src/_cjs/providers/hyperliquid/mappers/index.js.map +0 -1
  175. package/src/_cjs/providers/hyperliquid/mappers/market.js +0 -28
  176. package/src/_cjs/providers/hyperliquid/mappers/market.js.map +0 -1
  177. package/src/_cjs/providers/hyperliquid/mappers/order.js +0 -76
  178. package/src/_cjs/providers/hyperliquid/mappers/order.js.map +0 -1
  179. package/src/_cjs/providers/hyperliquid/mappers/position.js +0 -29
  180. package/src/_cjs/providers/hyperliquid/mappers/position.js.map +0 -1
  181. package/src/_cjs/providers/hyperliquid/mappers/shared.js +0 -12
  182. package/src/_cjs/providers/hyperliquid/mappers/shared.js.map +0 -1
  183. package/src/_cjs/providers/hyperliquid/types.js.map +0 -1
  184. package/src/_cjs/trading.js +0 -3
  185. package/src/_cjs/trading.js.map +0 -1
  186. package/src/_cjs/withdrawal.js +0 -3
  187. package/src/_cjs/withdrawal.js.map +0 -1
  188. package/src/_esm/authorization.js +0 -2
  189. package/src/_esm/authorization.js.map +0 -1
  190. package/src/_esm/enums.js +0 -103
  191. package/src/_esm/enums.js.map +0 -1
  192. package/src/_esm/errors.js.map +0 -1
  193. package/src/_esm/index.js +0 -10
  194. package/src/_esm/index.js.map +0 -1
  195. package/src/_esm/market.js.map +0 -1
  196. package/src/_esm/providers/hyperliquid/assetId.js +0 -23
  197. package/src/_esm/providers/hyperliquid/assetId.js.map +0 -1
  198. package/src/_esm/providers/hyperliquid/index.js +0 -4
  199. package/src/_esm/providers/hyperliquid/index.js.map +0 -1
  200. package/src/_esm/providers/hyperliquid/mappers/activity.js +0 -59
  201. package/src/_esm/providers/hyperliquid/mappers/activity.js.map +0 -1
  202. package/src/_esm/providers/hyperliquid/mappers/history.js +0 -18
  203. package/src/_esm/providers/hyperliquid/mappers/history.js.map +0 -1
  204. package/src/_esm/providers/hyperliquid/mappers/index.js +0 -7
  205. package/src/_esm/providers/hyperliquid/mappers/index.js.map +0 -1
  206. package/src/_esm/providers/hyperliquid/mappers/market.js +0 -24
  207. package/src/_esm/providers/hyperliquid/mappers/market.js.map +0 -1
  208. package/src/_esm/providers/hyperliquid/mappers/order.js +0 -71
  209. package/src/_esm/providers/hyperliquid/mappers/order.js.map +0 -1
  210. package/src/_esm/providers/hyperliquid/mappers/position.js +0 -25
  211. package/src/_esm/providers/hyperliquid/mappers/position.js.map +0 -1
  212. package/src/_esm/providers/hyperliquid/mappers/shared.js +0 -13
  213. package/src/_esm/providers/hyperliquid/mappers/shared.js.map +0 -1
  214. package/src/_esm/providers/hyperliquid/types.js +0 -5
  215. package/src/_esm/providers/hyperliquid/types.js.map +0 -1
  216. package/src/_esm/trading.js +0 -2
  217. package/src/_esm/trading.js.map +0 -1
  218. package/src/_esm/withdrawal.js +0 -2
  219. package/src/_esm/withdrawal.js.map +0 -1
  220. package/src/_types/account.d.ts +0 -113
  221. package/src/_types/account.d.ts.map +0 -1
  222. package/src/_types/authorization.d.ts +0 -39
  223. package/src/_types/authorization.d.ts.map +0 -1
  224. package/src/_types/enums.d.ts +0 -84
  225. package/src/_types/enums.d.ts.map +0 -1
  226. package/src/_types/errors.d.ts.map +0 -1
  227. package/src/_types/index.d.ts +0 -10
  228. package/src/_types/index.d.ts.map +0 -1
  229. package/src/_types/market.d.ts.map +0 -1
  230. package/src/_types/providers/hyperliquid/assetId.d.ts +0 -12
  231. package/src/_types/providers/hyperliquid/assetId.d.ts.map +0 -1
  232. package/src/_types/providers/hyperliquid/index.d.ts +0 -4
  233. package/src/_types/providers/hyperliquid/index.d.ts.map +0 -1
  234. package/src/_types/providers/hyperliquid/mappers/activity.d.ts +0 -13
  235. package/src/_types/providers/hyperliquid/mappers/activity.d.ts.map +0 -1
  236. package/src/_types/providers/hyperliquid/mappers/history.d.ts +0 -4
  237. package/src/_types/providers/hyperliquid/mappers/history.d.ts.map +0 -1
  238. package/src/_types/providers/hyperliquid/mappers/index.d.ts +0 -7
  239. package/src/_types/providers/hyperliquid/mappers/index.d.ts.map +0 -1
  240. package/src/_types/providers/hyperliquid/mappers/market.d.ts +0 -4
  241. package/src/_types/providers/hyperliquid/mappers/market.d.ts.map +0 -1
  242. package/src/_types/providers/hyperliquid/mappers/order.d.ts +0 -6
  243. package/src/_types/providers/hyperliquid/mappers/order.d.ts.map +0 -1
  244. package/src/_types/providers/hyperliquid/mappers/position.d.ts +0 -4
  245. package/src/_types/providers/hyperliquid/mappers/position.d.ts.map +0 -1
  246. package/src/_types/providers/hyperliquid/mappers/shared.d.ts +0 -7
  247. package/src/_types/providers/hyperliquid/mappers/shared.d.ts.map +0 -1
  248. package/src/_types/providers/hyperliquid/types.d.ts +0 -201
  249. package/src/_types/providers/hyperliquid/types.d.ts.map +0 -1
  250. package/src/_types/subscriptions.d.ts.map +0 -1
  251. package/src/_types/trading.d.ts +0 -80
  252. package/src/_types/trading.d.ts.map +0 -1
  253. package/src/_types/typedData.d.ts +0 -10
  254. package/src/_types/typedData.d.ts.map +0 -1
  255. package/src/_types/withdrawal.d.ts +0 -37
  256. package/src/_types/withdrawal.d.ts.map +0 -1
  257. package/src/authorization.ts +0 -46
  258. package/src/providers/hyperliquid/assetId.ts +0 -26
  259. package/src/providers/hyperliquid/index.ts +0 -3
  260. package/src/providers/hyperliquid/mappers/activity.ts +0 -84
  261. package/src/providers/hyperliquid/mappers/history.ts +0 -25
  262. package/src/providers/hyperliquid/mappers/index.ts +0 -6
  263. package/src/providers/hyperliquid/mappers/market.ts +0 -35
  264. package/src/providers/hyperliquid/mappers/order.ts +0 -88
  265. package/src/providers/hyperliquid/mappers/position.ts +0 -35
  266. package/src/providers/hyperliquid/mappers/shared.ts +0 -15
  267. package/src/providers/hyperliquid/types.ts +0 -255
  268. package/src/trading.ts +0 -97
  269. package/src/withdrawal.ts +0 -44
  270. /package/{src/_cjs → dist/cjs}/account.js +0 -0
  271. /package/{src/_types → dist/cjs}/errors.d.ts +0 -0
  272. /package/{src/_cjs → dist/cjs}/errors.js +0 -0
  273. /package/{src/_cjs → dist/cjs}/market.js +0 -0
  274. /package/{src/_cjs → dist/cjs}/package.json +0 -0
  275. /package/{src/_cjs → dist/cjs}/subscriptions.js +0 -0
  276. /package/{src/_cjs → dist/cjs}/typedData.js +0 -0
  277. /package/{src/_esm → dist/esm}/account.js +0 -0
  278. /package/{src/_esm → dist/esm}/errors.js +0 -0
  279. /package/{src/_esm → dist/esm}/market.js +0 -0
  280. /package/{src/_esm → dist/esm}/package.json +0 -0
  281. /package/{src/_esm → dist/esm}/subscriptions.js +0 -0
  282. /package/{src/_esm → dist/esm}/typedData.js +0 -0
package/src/meta.ts ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * A single platform-level advisory shown to all users, independent of any
3
+ * provider or market.
4
+ * @public
5
+ */
6
+ export interface Notice {
7
+ /** Unix epoch milliseconds. */
8
+ timestamp: number
9
+ title: string
10
+ message: string
11
+ /** Optional URL the notice links to; rendered as a hyperlink when present. */
12
+ link?: string
13
+ }
14
+
15
+ /**
16
+ * Read-only platform metadata served by `GET /v1/perps/meta`.
17
+ * @public
18
+ */
19
+ export interface Meta {
20
+ version: string
21
+ notices: Notice[]
22
+ }
23
+
24
+ /**
25
+ * Current Terms-of-Service and this address's acceptance, served by
26
+ * `GET /v1/perps/meta/terms?address=`.
27
+ * @public
28
+ */
29
+ export interface TermsAcceptanceStatus {
30
+ /** Backend-owned version identifier for the current terms. */
31
+ termsVersion: string
32
+ /** Full current terms-of-service text. */
33
+ content: string
34
+ /** Whether the queried address has accepted {@link TermsAcceptanceStatus.termsVersion}. */
35
+ accepted: boolean
36
+ /** Unix epoch milliseconds the address accepted; absent when not accepted. */
37
+ acceptedAt?: number
38
+ }
@@ -0,0 +1,5 @@
1
+ /** @public */
2
+ export type Address = `0x${string}`
3
+
4
+ /** @public */
5
+ export type Hex = `0x${string}`
@@ -0,0 +1,122 @@
1
+ import type { Asset } from './asset.js'
2
+ import type { ActionType, PerpsSigner, SigningMethod } from './enums.js'
3
+ import type { OhlcvInterval } from './market.js'
4
+
5
+ /** @public */
6
+ export interface ParamOption {
7
+ value: string
8
+ label: string
9
+ }
10
+
11
+ /** @public */
12
+ export interface Param {
13
+ /** Wire key for the action params object: `{ [param.name]: value }`. */
14
+ name: string
15
+ type: 'string'
16
+ /** Present iff the parameter has a fixed enumeration of admissible values. */
17
+ values?: ParamOption[]
18
+ default?: ParamOption
19
+ readOnly?: boolean
20
+ }
21
+
22
+ /**
23
+ * A single provider action. The same shape backs `Provider.setup`,
24
+ * `Provider.options`, and `Provider.actions` — categorisation lives in which
25
+ * array it sits in, not in the type. The core three fields are always present;
26
+ * the rest are presentation/ordering hints provided per-action in the
27
+ * provider's hardcoded metadata.
28
+ * @public
29
+ */
30
+ export interface ProviderAction {
31
+ type: ActionType
32
+ signers: PerpsSigner[]
33
+ signingMethod: SigningMethod
34
+ /**
35
+ * Human label. Drives the card heading in the setup/options modals, and may
36
+ * also front an in-flight trading action ("{title} is working…").
37
+ */
38
+ title?: string
39
+ description?: string
40
+ /** UI form fields the widget renders to collect input for this action. */
41
+ params?: Param[]
42
+ /**
43
+ * Ascending order in which the user satisfies setup steps. Cloud-init
44
+ * convention: 10, 20, 30, … with 99 reserved for "always last"; the gaps
45
+ * leave room to insert steps later without renumbering. Lower runs first;
46
+ * a step may depend on every lower-sequenced step already being satisfied.
47
+ */
48
+ sequence?: number
49
+ }
50
+
51
+ /**
52
+ * Provider-attached advisory shown against a market. Provider-agnostic: the
53
+ * producer decides when to emit one (e.g. an HL HIP-3 sub-dex risk warning).
54
+ * @public
55
+ */
56
+ export interface TradeNotice {
57
+ /** Maps to the widget's panel styling: `warn` → warning, `info` → info. */
58
+ level: 'info' | 'warn'
59
+ /** Plaintext; any URL is rendered as text, not a hyperlink. */
60
+ message: string
61
+ }
62
+
63
+ /** @public */
64
+ export interface ProviderCategory {
65
+ id: string
66
+ logoURI?: string
67
+ /** `null` for the "spot" category — no single fixed quote. */
68
+ quoteAsset: Asset | null
69
+ tradeNotice?: TradeNotice
70
+ }
71
+
72
+ /** @public */
73
+ export interface Provider {
74
+ key: string
75
+ name: string
76
+ logoURI: string
77
+ signingMethod: SigningMethod
78
+ /** When false, the provider is announced but not yet selectable in clients. */
79
+ active: boolean
80
+ setup: ProviderAction[]
81
+ options: ProviderAction[]
82
+ actions: ProviderAction[]
83
+ categories: ProviderCategory[]
84
+ wsUrl?: string
85
+ /** Absent means no minimum advertised. */
86
+ minDepositUsd?: number
87
+ /**
88
+ * Minimum order notional value in USD. Feeds the SDK's `validateMargin`
89
+ * `minMarginUsd` parameter. Absent means no minimum advertised.
90
+ */
91
+ minOrderValueUsd?: number
92
+ /**
93
+ * Minimum order notional value in USD for reduce-only orders, when the
94
+ * provider applies a lower floor than `minOrderValueUsd`. Absent means
95
+ * reduce-only orders use the same floor as `minOrderValueUsd`.
96
+ */
97
+ minReduceOrderValueUsd?: number
98
+ /** Minimum withdrawal notional in USD. Absent means no minimum advertised. */
99
+ minWithdrawalUsd?: number
100
+ /** Flat deposit fee in USD the provider charges. Absent means no fee advertised. */
101
+ depositFeeUsd?: number
102
+ /** Flat withdrawal fee in USD the provider charges. Absent means no fee advertised. */
103
+ withdrawalFeeUsd?: number
104
+ /**
105
+ * Aggregate up-votes for this provider. Populated only for inactive
106
+ * providers (those gathering demand before launch); absent once `active`.
107
+ */
108
+ upVotes?: number
109
+ /** Aggregate down-votes. Populated only for inactive providers; see {@link upVotes}. */
110
+ downVotes?: number
111
+ /**
112
+ * Candle intervals this provider supports for OHLCV/chart requests, in
113
+ * ascending order. Drives the client's chart interval selector. Empty for
114
+ * providers that expose no candle data.
115
+ */
116
+ supportedIntervals: OhlcvInterval[]
117
+ }
118
+
119
+ /** @public */
120
+ export interface ProvidersResponse {
121
+ providers: Provider[]
122
+ }
package/src/quote.ts ADDED
@@ -0,0 +1,49 @@
1
+ import type { FeeTier } from './account.js'
2
+ import type { FundingInfo } from './market.js'
3
+
4
+ /** @public */
5
+ export type QuoteSide = 'buy' | 'sell'
6
+
7
+ /** @public */
8
+ export type TradeType = 'perps' | 'spot'
9
+
10
+ /**
11
+ * One-shot fill estimate for a market order of `sizeUsd` notional on a single
12
+ * venue: the VWAP fill walked from the orderbook, the price impact versus the
13
+ * mark, the base-tier taker fee, and (for perps) the current funding rate.
14
+ *
15
+ * `priceImpactBps` is signed-magnitude basis points (1 bps = 0.01%) of the
16
+ * VWAP fill's deviation from `markPrice` — always non-negative, since a buy
17
+ * fills above mark and a sell below.
18
+ * @public
19
+ */
20
+ export interface Quote {
21
+ provider: string
22
+ /** Human `displaySymbol` the quote was resolved against, e.g. `"BTC"`. */
23
+ symbol: string
24
+ /** Opaque resolved `Market.id`. */
25
+ marketId: string
26
+ type: TradeType
27
+ side: QuoteSide
28
+ /** Input notional in USD. */
29
+ sizeUsd: string
30
+ /** Base amount the book filled for `sizeUsd` (or the most obtainable when the book is too thin). */
31
+ baseSize: string
32
+ markPrice: string
33
+ /** Volume-weighted average fill price from the book walk. */
34
+ expectedFillPrice: string
35
+ /** VWAP deviation from `markPrice` in basis points; non-negative. */
36
+ priceImpactBps: string
37
+ /** Base maker/taker fee fractions (not bps) for the public tier. */
38
+ feeTier: FeeTier
39
+ /** Always `true` in v1 — quotes use the public base tier, never a per-account tier. */
40
+ isDefaultFeeTier: boolean
41
+ /** Taker fee on the filled notional in USD: `filledNotional * feeTier.taker`. */
42
+ feeUsd: string
43
+ /** Current funding for perps; `null` for spot. */
44
+ funding: FundingInfo | null
45
+ /** `true` when the book could not fill the full `sizeUsd` — `baseSize`/fill reflect the best obtainable. */
46
+ insufficientLiquidity: boolean
47
+ /** Unix milliseconds the quote was produced. */
48
+ timestamp: number
49
+ }
@@ -1,73 +1,118 @@
1
- import type { Address } from './typedData.js'
2
1
  import type {
3
- Candle,
4
- OhlcvInterval,
5
- OrderbookResponse,
6
- PricesResponse,
7
- } from './market.js'
8
- import type { HistoryItem, Position } from './account.js'
9
- import type { Order } from './trading.js'
10
-
11
- // --- Channels the user can subscribe to ---
2
+ Balance,
3
+ Fill,
4
+ OpenOrder,
5
+ Position,
6
+ TriggerOrder,
7
+ } from './account.js'
8
+ import type { Candle, OhlcvInterval, OrderbookResponse } from './market.js'
9
+ import type { Address } from './primitives.js'
12
10
 
11
+ /** @public */
13
12
  export type PricesSubscription = { channel: 'prices'; dex: string }
13
+ /** @public */
14
14
  export type OrderbookSubscription = {
15
15
  channel: 'orderbook'
16
16
  dex: string
17
- symbol: string
17
+ marketId: string
18
18
  depth?: number
19
+ /**
20
+ * Desired price granularity of streamed levels, in quote currency (e.g.
21
+ * `10` buckets a BTC book into $10-wide levels). Providers that aggregate
22
+ * the book server-side honour it best-effort; providers that stream the
23
+ * full book ignore it. `undefined` requests full precision.
24
+ */
25
+ priceStep?: number
19
26
  }
20
- export type TradesSubscription = {
21
- channel: 'trades'
22
- dex: string
23
- symbol: string
24
- }
27
+ /** @public */
25
28
  export type CandleSubscription = {
26
29
  channel: 'candle'
27
30
  dex: string
28
- symbol: string
31
+ marketId: string
29
32
  interval: OhlcvInterval
30
33
  }
34
+ /** @public */
31
35
  export type OrderUpdatesSubscription = {
32
36
  channel: 'orderUpdates'
33
37
  dex: string
34
38
  address: Address
35
39
  }
40
+ /** @public */
36
41
  export type FillsSubscription = {
37
42
  channel: 'fills'
38
43
  dex: string
39
44
  address: Address
40
45
  }
46
+ /** @public */
41
47
  export type PositionsSubscription = {
42
48
  channel: 'positions'
43
49
  dex: string
44
50
  address: Address
45
51
  }
52
+ /** @public */
53
+ export type SpotBalancesSubscription = {
54
+ channel: 'spotBalances'
55
+ dex: string
56
+ address: Address
57
+ }
46
58
 
59
+ /** @public */
47
60
  export type Subscription =
48
61
  | PricesSubscription
49
62
  | OrderbookSubscription
50
- | TradesSubscription
51
63
  | CandleSubscription
52
64
  | OrderUpdatesSubscription
53
65
  | FillsSubscription
54
66
  | PositionsSubscription
67
+ | SpotBalancesSubscription
55
68
 
56
- // --- Events emitted to listeners ---
57
-
58
- export type PricesEvent = { channel: 'prices'; data: PricesResponse }
69
+ /** @public */
70
+ export type PricesEvent = { channel: 'prices'; data: Record<string, string> }
71
+ /** @public */
59
72
  export type OrderbookEvent = { channel: 'orderbook'; data: OrderbookResponse }
60
- export type TradesEvent = { channel: 'trades'; data: HistoryItem[] }
73
+ /** @public */
61
74
  export type CandleEvent = { channel: 'candle'; data: Candle }
62
- export type OrderUpdatesEvent = { channel: 'orderUpdates'; data: Order[] }
63
- export type FillsEvent = { channel: 'fills'; data: HistoryItem[] }
75
+ /** @public */
76
+ export type OrderUpdatesEvent = {
77
+ channel: 'orderUpdates'
78
+ data: {
79
+ /** Upserts — active orders, non-trigger. */
80
+ openOrders: OpenOrder[]
81
+ /** Upserts — active orders with trigger semantics (TP/SL). */
82
+ triggerOrders: TriggerOrder[]
83
+ /**
84
+ * orderIds whose status just transitioned to terminal (filled, cancelled,
85
+ * rejected, expired). Consumers should evict these from both buckets.
86
+ */
87
+ terminated: string[]
88
+ }
89
+ }
90
+ /** @public */
91
+ export type FillsEvent = { channel: 'fills'; data: Fill[] }
92
+ /**
93
+ * Positions stream frame. `data` is always the full set of currently open
94
+ * positions for the subscribed address, never a partial update: zero-size
95
+ * entries never appear, and a close is observed as the market's absence from
96
+ * the next frame. Consumers replace their state; they must not merge.
97
+ * @public
98
+ */
64
99
  export type PositionsEvent = { channel: 'positions'; data: Position[] }
100
+ /**
101
+ * Spot holdings as typed {@link Balance}s, each carrying the venue-locked
102
+ * portion (`locked` = reserved against open orders; `available = units − locked`).
103
+ * @public
104
+ */
105
+ export type SpotBalancesEvent = {
106
+ channel: 'spotBalances'
107
+ data: (Balance & { locked: string })[]
108
+ }
65
109
 
110
+ /** @public */
66
111
  export type SubscriptionEvent =
67
112
  | PricesEvent
68
113
  | OrderbookEvent
69
- | TradesEvent
70
114
  | CandleEvent
71
115
  | OrderUpdatesEvent
72
116
  | FillsEvent
73
117
  | PositionsEvent
118
+ | SpotBalancesEvent
package/src/typedData.ts CHANGED
@@ -1,13 +1,32 @@
1
- import type { TypedData, SignedTypedData } from '@lifi/types'
2
- import type { Address, Hex, TypedDataDomain, TypedDataParameter } from 'viem'
1
+ import type { Address, Hex } from './primitives.js'
3
2
 
4
- export type PerpsTypedData = Omit<TypedData, 'primaryType'> & {
5
- primaryType: string
3
+ /** @public */
4
+ export interface TypedDataDomain {
5
+ name?: string
6
+ version?: string
7
+ chainId?: number
8
+ verifyingContract?: Address
9
+ salt?: Hex
6
10
  }
7
11
 
8
- export type PerpsSignedTypedData = Omit<SignedTypedData, 'primaryType'> & {
9
- primaryType: string
12
+ /** @public */
13
+ export interface TypedDataParameter {
14
+ name: string
15
+ type: string
10
16
  }
11
17
 
12
- // Re-export viem primitives used across perps types
13
- export type { Address, Hex, TypedDataDomain, TypedDataParameter }
18
+ /** @public */
19
+ export type PerpsPrimaryType = string
20
+
21
+ /** @public */
22
+ export type PerpsTypedData = {
23
+ domain: TypedDataDomain
24
+ types: Record<string, readonly TypedDataParameter[]>
25
+ primaryType: PerpsPrimaryType
26
+ message: Record<string, any>
27
+ }
28
+
29
+ /** @public */
30
+ export type PerpsSignedTypedData = PerpsTypedData & {
31
+ signature: Hex
32
+ }
package/src/vote.ts ADDED
@@ -0,0 +1,79 @@
1
+ import type { Address } from './primitives.js'
2
+ import type { PerpsTypedData, TypedDataParameter } from './typedData.js'
3
+
4
+ /**
5
+ * Sentinel sent in the `provider` field for provider-independent actions
6
+ * (e.g. {@link "./enums.js".ActionType.META_VOTE}). The backend dispatches
7
+ * on this value instead of resolving a real provider plugin.
8
+ * @public
9
+ */
10
+ export const META_PROVIDER = 'meta'
11
+
12
+ /** @public */
13
+ export type MetaProvider = typeof META_PROVIDER
14
+
15
+ /**
16
+ * Vote direction. `up` endorses the subject; `down` opposes it.
17
+ * @public
18
+ */
19
+ export type VoteDirection = 'up' | 'down'
20
+
21
+ /**
22
+ * Discriminates what a vote is about, leaving room for future product-level
23
+ * vote subjects without changing the EIP-712 `primaryType`.
24
+ * @public
25
+ */
26
+ export type VoteType = 'provider'
27
+
28
+ /**
29
+ * Params for an {@link "./enums.js".ActionType.META_VOTE} action.
30
+ *
31
+ * `targetProvider` is the voted-on subject — kept distinct from the transport
32
+ * `provider` field, which carries the {@link META_PROVIDER} sentinel for this
33
+ * provider-independent action.
34
+ * @public
35
+ */
36
+ export interface VoteParams {
37
+ /** Key of the inactive provider being voted on (the voted-on subject). */
38
+ targetProvider: string
39
+ direction: VoteDirection
40
+ voteType: VoteType
41
+ }
42
+
43
+ /**
44
+ * EIP-712 message body for a `Vote`. Field order matches {@link voteTypeFields}.
45
+ * @public
46
+ */
47
+ export interface VoteMessage {
48
+ /** Key of the inactive provider being voted on. */
49
+ targetProvider: string
50
+ direction: VoteDirection
51
+ voteType: VoteType
52
+ voter: Address
53
+ /** Unix timestamp in milliseconds. */
54
+ timestamp: number
55
+ }
56
+
57
+ /**
58
+ * EIP-712 type member list for the `Vote` primary type. Field order is part of
59
+ * the signed digest and must match the backend's encoder.
60
+ * @public
61
+ */
62
+ export const voteTypeFields: readonly TypedDataParameter[] = [
63
+ { name: 'targetProvider', type: 'string' },
64
+ { name: 'direction', type: 'string' },
65
+ { name: 'voteType', type: 'string' },
66
+ { name: 'voter', type: 'address' },
67
+ { name: 'timestamp', type: 'uint256' },
68
+ ]
69
+
70
+ /**
71
+ * EIP-712 typed data for a vote, as returned by `createAction` and signed
72
+ * client-side. `primaryType` is always `'Vote'`.
73
+ * @public
74
+ */
75
+ export interface VoteTypedData extends PerpsTypedData {
76
+ primaryType: 'Vote'
77
+ types: { Vote: readonly TypedDataParameter[] } & PerpsTypedData['types']
78
+ message: VoteMessage
79
+ }
@@ -1,5 +0,0 @@
1
- {
2
- "types": "../../src/_types/providers/hyperliquid/index.d.ts",
3
- "module": "../../src/_esm/providers/hyperliquid/index.js",
4
- "main": "../../src/_cjs/providers/hyperliquid/index.js"
5
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=authorization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorization.js","sourceRoot":"","sources":["../authorization.ts"],"names":[],"mappings":""}
package/src/_cjs/enums.js DELETED
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActivityType = exports.TriggerOrderStatus = exports.TriggerOrderType = exports.TriggerCondition = exports.OrderActionType = exports.HistoryItemStatus = exports.OrderStatus = exports.TimeInForce = exports.MarginMode = exports.PositionSide = exports.OrderType = exports.OrderSide = exports.PerpsErrorCode = void 0;
4
- var PerpsErrorCode;
5
- (function (PerpsErrorCode) {
6
- PerpsErrorCode[PerpsErrorCode["DefaultError"] = 2000] = "DefaultError";
7
- PerpsErrorCode[PerpsErrorCode["ServerError"] = 2001] = "ServerError";
8
- PerpsErrorCode[PerpsErrorCode["ValidationError"] = 2002] = "ValidationError";
9
- PerpsErrorCode[PerpsErrorCode["TimeoutError"] = 2003] = "TimeoutError";
10
- PerpsErrorCode[PerpsErrorCode["ThirdPartyError"] = 2004] = "ThirdPartyError";
11
- PerpsErrorCode[PerpsErrorCode["SignatureInvalid"] = 2010] = "SignatureInvalid";
12
- PerpsErrorCode[PerpsErrorCode["AgentUnauthorized"] = 2011] = "AgentUnauthorized";
13
- PerpsErrorCode[PerpsErrorCode["ExchangeRejected"] = 2020] = "ExchangeRejected";
14
- PerpsErrorCode[PerpsErrorCode["InsufficientMargin"] = 2021] = "InsufficientMargin";
15
- PerpsErrorCode[PerpsErrorCode["InsufficientBalance"] = 2022] = "InsufficientBalance";
16
- PerpsErrorCode[PerpsErrorCode["MarketNotFound"] = 2023] = "MarketNotFound";
17
- PerpsErrorCode[PerpsErrorCode["OrderNotFound"] = 2024] = "OrderNotFound";
18
- PerpsErrorCode[PerpsErrorCode["PositionNotFound"] = 2025] = "PositionNotFound";
19
- PerpsErrorCode[PerpsErrorCode["InvalidNonce"] = 2040] = "InvalidNonce";
20
- PerpsErrorCode[PerpsErrorCode["NonceAlreadyUsed"] = 2041] = "NonceAlreadyUsed";
21
- PerpsErrorCode[PerpsErrorCode["NonceExpired"] = 2042] = "NonceExpired";
22
- PerpsErrorCode[PerpsErrorCode["PayloadMismatch"] = 2050] = "PayloadMismatch";
23
- PerpsErrorCode[PerpsErrorCode["RouteNotFound"] = 2060] = "RouteNotFound";
24
- })(PerpsErrorCode || (exports.PerpsErrorCode = PerpsErrorCode = {}));
25
- var OrderSide;
26
- (function (OrderSide) {
27
- OrderSide["BUY"] = "BUY";
28
- OrderSide["SELL"] = "SELL";
29
- })(OrderSide || (exports.OrderSide = OrderSide = {}));
30
- var OrderType;
31
- (function (OrderType) {
32
- OrderType["MARKET"] = "MARKET";
33
- OrderType["LIMIT"] = "LIMIT";
34
- })(OrderType || (exports.OrderType = OrderType = {}));
35
- var PositionSide;
36
- (function (PositionSide) {
37
- PositionSide["LONG"] = "LONG";
38
- PositionSide["SHORT"] = "SHORT";
39
- })(PositionSide || (exports.PositionSide = PositionSide = {}));
40
- var MarginMode;
41
- (function (MarginMode) {
42
- MarginMode["ISOLATED"] = "ISOLATED";
43
- MarginMode["CROSS"] = "CROSS";
44
- })(MarginMode || (exports.MarginMode = MarginMode = {}));
45
- var TimeInForce;
46
- (function (TimeInForce) {
47
- TimeInForce["GTC"] = "GTC";
48
- TimeInForce["IOC"] = "IOC";
49
- TimeInForce["POST_ONLY"] = "POST_ONLY";
50
- TimeInForce["GTT"] = "GTT";
51
- })(TimeInForce || (exports.TimeInForce = TimeInForce = {}));
52
- var OrderStatus;
53
- (function (OrderStatus) {
54
- OrderStatus["PENDING"] = "PENDING";
55
- OrderStatus["OPEN"] = "OPEN";
56
- OrderStatus["PARTIALLY_FILLED"] = "PARTIALLY_FILLED";
57
- OrderStatus["FILLED"] = "FILLED";
58
- OrderStatus["CANCELLED"] = "CANCELLED";
59
- OrderStatus["REJECTED"] = "REJECTED";
60
- OrderStatus["EXPIRED"] = "EXPIRED";
61
- OrderStatus["TRIGGERED"] = "TRIGGERED";
62
- })(OrderStatus || (exports.OrderStatus = OrderStatus = {}));
63
- var HistoryItemStatus;
64
- (function (HistoryItemStatus) {
65
- HistoryItemStatus["FILLED"] = "FILLED";
66
- HistoryItemStatus["PARTIALLY_FILLED"] = "PARTIALLY_FILLED";
67
- HistoryItemStatus["CANCELLED"] = "CANCELLED";
68
- HistoryItemStatus["REJECTED"] = "REJECTED";
69
- })(HistoryItemStatus || (exports.HistoryItemStatus = HistoryItemStatus = {}));
70
- var OrderActionType;
71
- (function (OrderActionType) {
72
- OrderActionType["UPDATE_LEVERAGE"] = "updateLeverage";
73
- OrderActionType["PLACE_ORDER"] = "placeOrder";
74
- OrderActionType["PLACE_TRIGGER_ORDER"] = "placeTriggerOrder";
75
- OrderActionType["CANCEL_ORDER"] = "cancelOrder";
76
- })(OrderActionType || (exports.OrderActionType = OrderActionType = {}));
77
- var TriggerCondition;
78
- (function (TriggerCondition) {
79
- TriggerCondition["ABOVE"] = "ABOVE";
80
- TriggerCondition["BELOW"] = "BELOW";
81
- })(TriggerCondition || (exports.TriggerCondition = TriggerCondition = {}));
82
- var TriggerOrderType;
83
- (function (TriggerOrderType) {
84
- TriggerOrderType["TAKE_PROFIT"] = "TAKE_PROFIT";
85
- TriggerOrderType["STOP_LOSS"] = "STOP_LOSS";
86
- })(TriggerOrderType || (exports.TriggerOrderType = TriggerOrderType = {}));
87
- var TriggerOrderStatus;
88
- (function (TriggerOrderStatus) {
89
- TriggerOrderStatus["WAITING"] = "WAITING";
90
- TriggerOrderStatus["TRIGGERED"] = "TRIGGERED";
91
- TriggerOrderStatus["CANCELLED"] = "CANCELLED";
92
- })(TriggerOrderStatus || (exports.TriggerOrderStatus = TriggerOrderStatus = {}));
93
- var ActivityType;
94
- (function (ActivityType) {
95
- ActivityType["DEPOSIT"] = "DEPOSIT";
96
- ActivityType["WITHDRAWAL"] = "WITHDRAWAL";
97
- ActivityType["LIQUIDATION"] = "LIQUIDATION";
98
- ActivityType["FUNDING"] = "FUNDING";
99
- })(ActivityType || (exports.ActivityType = ActivityType = {}));
100
- //# sourceMappingURL=enums.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../enums.ts"],"names":[],"mappings":";;;AAAA,IAAY,cA8BX;AA9BD,WAAY,cAAc;IAExB,sEAAmB,CAAA;IACnB,oEAAkB,CAAA;IAClB,4EAAsB,CAAA;IACtB,sEAAmB,CAAA;IACnB,4EAAsB,CAAA;IAGtB,8EAAuB,CAAA;IACvB,gFAAwB,CAAA;IAGxB,8EAAuB,CAAA;IACvB,kFAAyB,CAAA;IACzB,oFAA0B,CAAA;IAC1B,0EAAqB,CAAA;IACrB,wEAAoB,CAAA;IACpB,8EAAuB,CAAA;IAGvB,sEAAmB,CAAA;IACnB,8EAAuB,CAAA;IACvB,sEAAmB,CAAA;IAGnB,4EAAsB,CAAA;IAGtB,wEAAoB,CAAA;AACtB,CAAC,EA9BW,cAAc,8BAAd,cAAc,QA8BzB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,4BAAe,CAAA;AACjB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,0BAAW,CAAA;IACX,0BAAW,CAAA;IACX,sCAAuB,CAAA;IACvB,0BAAW,CAAA;AACb,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAED,IAAY,WASX;AATD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,oDAAqC,CAAA;IACrC,gCAAiB,CAAA;IACjB,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;AACzB,CAAC,EATW,WAAW,2BAAX,WAAW,QAStB;AAED,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,0DAAqC,CAAA;IACrC,4CAAuB,CAAA;IACvB,0CAAqB,CAAA;AACvB,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B;AAED,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,qDAAkC,CAAA;IAClC,6CAA0B,CAAA;IAC1B,4DAAyC,CAAA;IACzC,+CAA4B,CAAA;AAC9B,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,mCAAe,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+CAA2B,CAAA;IAC3B,2CAAuB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,6CAAuB,CAAA;IACvB,6CAAuB,CAAA;AACzB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,2CAA2B,CAAA;IAC3B,mCAAmB,CAAA;AACrB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../errors.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,6CAA0B;AAC1B,8CAA2B;AAC3B,qDAAkC;AAClC,+CAA4B;AAC5B,+CAA4B;AAC5B,kDAA+B;AAC/B,8CAA2B;AAC3B,qDAAkC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"market.js","sourceRoot":"","sources":["../market.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDexIndex = exports.calculateAssetId = void 0;
4
- const calculateAssetId = (dexIndex, indexInDex) => {
5
- if (dexIndex === 0) {
6
- return indexInDex;
7
- }
8
- return 100_000 + dexIndex * 10_000 + indexInDex;
9
- };
10
- exports.calculateAssetId = calculateAssetId;
11
- const getDexIndex = (dex, dexNames) => {
12
- const index = dexNames.indexOf(dex);
13
- if (index === -1) {
14
- throw new Error(`Unknown sub-dex: ${dex}`);
15
- }
16
- return index;
17
- };
18
- exports.getDexIndex = getDexIndex;
19
- //# sourceMappingURL=assetId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assetId.js","sourceRoot":"","sources":["../../../providers/hyperliquid/assetId.ts"],"names":[],"mappings":";;;AAMO,MAAM,gBAAgB,GAAG,CAC9B,QAAgB,EAChB,UAAkB,EACV,EAAE;IACV,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,UAAU,CAAA;IACnB,CAAC;IACD,OAAO,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAA;AACjD,CAAC,CAAA;AARY,QAAA,gBAAgB,oBAQ5B;AAKM,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,QAAkB,EAAU,EAAE;IACrE,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACnC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAA;IAC5C,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AANY,QAAA,WAAW,eAMvB"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types.js"), exports);
18
- __exportStar(require("./assetId.js"), exports);
19
- __exportStar(require("./mappers/index.js"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../providers/hyperliquid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,+CAA4B;AAC5B,qDAAkC"}