@metamask-previews/perps-controller 15.1.0-preview-6b7c25c → 15.1.0-preview-00a181c

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 (130) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/PerpsController-method-action-types.cjs.map +1 -1
  3. package/dist/PerpsController-method-action-types.d.cts +20 -1
  4. package/dist/PerpsController-method-action-types.d.cts.map +1 -1
  5. package/dist/PerpsController-method-action-types.d.mts +20 -1
  6. package/dist/PerpsController-method-action-types.d.mts.map +1 -1
  7. package/dist/PerpsController-method-action-types.mjs.map +1 -1
  8. package/dist/PerpsController.cjs +65 -154
  9. package/dist/PerpsController.cjs.map +1 -1
  10. package/dist/PerpsController.d.cts +37 -43
  11. package/dist/PerpsController.d.cts.map +1 -1
  12. package/dist/PerpsController.d.mts +37 -43
  13. package/dist/PerpsController.d.mts.map +1 -1
  14. package/dist/PerpsController.mjs +64 -151
  15. package/dist/PerpsController.mjs.map +1 -1
  16. package/dist/aggregation/SubscriptionMultiplexer.cjs +1 -1
  17. package/dist/aggregation/SubscriptionMultiplexer.cjs.map +1 -1
  18. package/dist/aggregation/SubscriptionMultiplexer.d.cts +1 -1
  19. package/dist/aggregation/SubscriptionMultiplexer.d.mts +1 -1
  20. package/dist/aggregation/SubscriptionMultiplexer.mjs +1 -1
  21. package/dist/aggregation/SubscriptionMultiplexer.mjs.map +1 -1
  22. package/dist/constants/index.cjs +0 -1
  23. package/dist/constants/index.cjs.map +1 -1
  24. package/dist/constants/index.d.cts +0 -1
  25. package/dist/constants/index.d.cts.map +1 -1
  26. package/dist/constants/index.d.mts +0 -1
  27. package/dist/constants/index.d.mts.map +1 -1
  28. package/dist/constants/index.mjs +0 -1
  29. package/dist/constants/index.mjs.map +1 -1
  30. package/dist/constants/perpsConfig.cjs +4 -9
  31. package/dist/constants/perpsConfig.cjs.map +1 -1
  32. package/dist/constants/perpsConfig.d.cts +3 -5
  33. package/dist/constants/perpsConfig.d.cts.map +1 -1
  34. package/dist/constants/perpsConfig.d.mts +3 -5
  35. package/dist/constants/perpsConfig.d.mts.map +1 -1
  36. package/dist/constants/perpsConfig.mjs +4 -9
  37. package/dist/constants/perpsConfig.mjs.map +1 -1
  38. package/dist/index.cjs +146 -175
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +2 -2
  41. package/dist/index.d.cts.map +1 -1
  42. package/dist/index.d.mts +2 -2
  43. package/dist/index.d.mts.map +1 -1
  44. package/dist/index.mjs +0 -1
  45. package/dist/index.mjs.map +1 -1
  46. package/dist/providers/AggregatedPerpsProvider.cjs +8 -2
  47. package/dist/providers/AggregatedPerpsProvider.cjs.map +1 -1
  48. package/dist/providers/AggregatedPerpsProvider.d.cts +3 -2
  49. package/dist/providers/AggregatedPerpsProvider.d.cts.map +1 -1
  50. package/dist/providers/AggregatedPerpsProvider.d.mts +3 -2
  51. package/dist/providers/AggregatedPerpsProvider.d.mts.map +1 -1
  52. package/dist/providers/AggregatedPerpsProvider.mjs +8 -2
  53. package/dist/providers/AggregatedPerpsProvider.mjs.map +1 -1
  54. package/dist/providers/HyperLiquidProvider.cjs +118 -22
  55. package/dist/providers/HyperLiquidProvider.cjs.map +1 -1
  56. package/dist/providers/HyperLiquidProvider.d.cts +31 -0
  57. package/dist/providers/HyperLiquidProvider.d.cts.map +1 -1
  58. package/dist/providers/HyperLiquidProvider.d.mts +31 -0
  59. package/dist/providers/HyperLiquidProvider.d.mts.map +1 -1
  60. package/dist/providers/HyperLiquidProvider.mjs +118 -22
  61. package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
  62. package/dist/providers/LighterProvider.cjs +1 -1
  63. package/dist/providers/LighterProvider.cjs.map +1 -1
  64. package/dist/providers/LighterProvider.mjs +1 -1
  65. package/dist/providers/LighterProvider.mjs.map +1 -1
  66. package/dist/routing/ProviderRouter.cjs +1 -1
  67. package/dist/routing/ProviderRouter.cjs.map +1 -1
  68. package/dist/routing/ProviderRouter.d.cts +1 -1
  69. package/dist/routing/ProviderRouter.d.mts +1 -1
  70. package/dist/routing/ProviderRouter.mjs +1 -1
  71. package/dist/routing/ProviderRouter.mjs.map +1 -1
  72. package/dist/services/HyperLiquidClientService.cjs.map +1 -1
  73. package/dist/services/HyperLiquidClientService.d.cts +26 -16
  74. package/dist/services/HyperLiquidClientService.d.cts.map +1 -1
  75. package/dist/services/HyperLiquidClientService.d.mts +26 -16
  76. package/dist/services/HyperLiquidClientService.d.mts.map +1 -1
  77. package/dist/services/HyperLiquidClientService.mjs.map +1 -1
  78. package/dist/services/HyperLiquidWalletService.cjs +80 -30
  79. package/dist/services/HyperLiquidWalletService.cjs.map +1 -1
  80. package/dist/services/HyperLiquidWalletService.d.cts +48 -22
  81. package/dist/services/HyperLiquidWalletService.d.cts.map +1 -1
  82. package/dist/services/HyperLiquidWalletService.d.mts +48 -22
  83. package/dist/services/HyperLiquidWalletService.d.mts.map +1 -1
  84. package/dist/services/HyperLiquidWalletService.mjs +80 -30
  85. package/dist/services/HyperLiquidWalletService.mjs.map +1 -1
  86. package/dist/services/LighterWalletService.cjs +1 -1
  87. package/dist/services/LighterWalletService.cjs.map +1 -1
  88. package/dist/services/LighterWalletService.d.cts +1 -1
  89. package/dist/services/LighterWalletService.d.mts +1 -1
  90. package/dist/services/LighterWalletService.mjs +1 -1
  91. package/dist/services/LighterWalletService.mjs.map +1 -1
  92. package/dist/types/index.cjs.map +1 -1
  93. package/dist/types/index.d.cts +10 -16
  94. package/dist/types/index.d.cts.map +1 -1
  95. package/dist/types/index.d.mts +10 -16
  96. package/dist/types/index.d.mts.map +1 -1
  97. package/dist/types/index.mjs.map +1 -1
  98. package/dist/utils/lighterAdapter.cjs +1 -2
  99. package/dist/utils/lighterAdapter.cjs.map +1 -1
  100. package/dist/utils/lighterAdapter.d.cts +1 -2
  101. package/dist/utils/lighterAdapter.d.cts.map +1 -1
  102. package/dist/utils/lighterAdapter.d.mts +1 -2
  103. package/dist/utils/lighterAdapter.d.mts.map +1 -1
  104. package/dist/utils/lighterAdapter.mjs +1 -2
  105. package/dist/utils/lighterAdapter.mjs.map +1 -1
  106. package/package.json +2 -8
  107. package/dist/constants/myxConfig.cjs +0 -253
  108. package/dist/constants/myxConfig.cjs.map +0 -1
  109. package/dist/constants/myxConfig.d.cts +0 -145
  110. package/dist/constants/myxConfig.d.cts.map +0 -1
  111. package/dist/constants/myxConfig.d.mts +0 -145
  112. package/dist/constants/myxConfig.d.mts.map +0 -1
  113. package/dist/constants/myxConfig.mjs +0 -243
  114. package/dist/constants/myxConfig.mjs.map +0 -1
  115. package/dist/types/myx-types.cjs +0 -41
  116. package/dist/types/myx-types.cjs.map +0 -1
  117. package/dist/types/myx-types.d.cts +0 -94
  118. package/dist/types/myx-types.d.cts.map +0 -1
  119. package/dist/types/myx-types.d.mts +0 -94
  120. package/dist/types/myx-types.d.mts.map +0 -1
  121. package/dist/types/myx-types.mjs +0 -26
  122. package/dist/types/myx-types.mjs.map +0 -1
  123. package/dist/utils/myxAdapter.cjs +0 -569
  124. package/dist/utils/myxAdapter.cjs.map +0 -1
  125. package/dist/utils/myxAdapter.d.cts +0 -168
  126. package/dist/utils/myxAdapter.d.cts.map +0 -1
  127. package/dist/utils/myxAdapter.d.mts +0 -168
  128. package/dist/utils/myxAdapter.d.mts.map +0 -1
  129. package/dist/utils/myxAdapter.mjs +0 -548
  130. package/dist/utils/myxAdapter.mjs.map +0 -1
@@ -1,253 +0,0 @@
1
- "use strict";
2
- /**
3
- * MYX Protocol Configuration Constants
4
- *
5
- * Configuration for market display, price fetching, and trading.
6
- * Based on MYX SDK patterns.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.MYX_EXECUTION_FEE_TOKEN = exports.MYX_PROTOCOL_FEE_RATE = exports.MYX_FEE_RATE = exports.MYX_MINIMUM_ORDER_SIZE_USD = exports.MYX_MAX_LEVERAGE = exports.MYX_DEFAULT_SLIPPAGE_BPS = exports.MYX_MAX_RETRIES = exports.MYX_HTTP_TIMEOUT_MS = exports.MYX_PRICE_POLLING_INTERVAL_MS = exports.fromMYXCollateral = exports.toMYXSize = exports.fromMYXSize = exports.toMYXPrice = exports.fromMYXPrice = exports.MYX_ASSET_CONFIGS = exports.USDT_BNB_MAINNET = exports.USDT_BNB_TESTNET = exports.MYX_COLLATERAL_TOKEN_MAINNET = exports.MYX_COLLATERAL_TOKEN_TESTNET = exports.MYX_COLLATERAL_DECIMALS = exports.MYX_SIZE_DECIMALS = exports.MYX_PRICE_DECIMALS = exports.getMYXHttpEndpoint = exports.MYX_ENDPOINTS = exports.getMYXChainId = exports.MYX_TESTNET_CAIP_CHAIN_ID = exports.MYX_MAINNET_CAIP_CHAIN_ID = exports.MYX_TESTNET_CHAIN_ID = exports.MYX_MAINNET_CHAIN_ID = void 0;
10
- const bignumber_js_1 = require("bignumber.js");
11
- // ============================================================================
12
- // Network Constants
13
- // ============================================================================
14
- /**
15
- * MYX Chain IDs
16
- * Mainnet: BNB Chain (56)
17
- * Testnet: Linea Sepolia (59141) — primary testnet chain with most active pools.
18
- * The testnet API also has one pool on Arbitrum Sepolia (421614) but it has no
19
- * ticker data, so Linea Sepolia is the effective testnet chain.
20
- */
21
- exports.MYX_MAINNET_CHAIN_ID = '56';
22
- exports.MYX_TESTNET_CHAIN_ID = '59141';
23
- exports.MYX_MAINNET_CAIP_CHAIN_ID = `eip155:${exports.MYX_MAINNET_CHAIN_ID}`;
24
- exports.MYX_TESTNET_CAIP_CHAIN_ID = `eip155:${exports.MYX_TESTNET_CHAIN_ID}`;
25
- /**
26
- * Get numeric chain ID for MYX network
27
- *
28
- * @param network - The MYX network environment (mainnet or testnet).
29
- * @returns The numeric chain ID for the specified network.
30
- */
31
- function getMYXChainId(network) {
32
- return network === 'testnet'
33
- ? parseInt(exports.MYX_TESTNET_CHAIN_ID, 10)
34
- : parseInt(exports.MYX_MAINNET_CHAIN_ID, 10);
35
- }
36
- exports.getMYXChainId = getMYXChainId;
37
- // ============================================================================
38
- // API Endpoints
39
- // ============================================================================
40
- /**
41
- * MYX REST and WebSocket endpoints
42
- */
43
- exports.MYX_ENDPOINTS = {
44
- mainnet: {
45
- http: 'https://api.myx.finance',
46
- ws: 'wss://oapi.myx.finance/ws',
47
- },
48
- testnet: {
49
- http: 'https://api-test.myx.cash',
50
- ws: 'wss://oapi-test.myx.cash/ws',
51
- },
52
- };
53
- /**
54
- * Get HTTP endpoint for network
55
- *
56
- * @param network - The MYX network environment (mainnet or testnet).
57
- * @returns The HTTP API endpoint URL for the specified network.
58
- */
59
- function getMYXHttpEndpoint(network) {
60
- return exports.MYX_ENDPOINTS[network].http;
61
- }
62
- exports.getMYXHttpEndpoint = getMYXHttpEndpoint;
63
- // ============================================================================
64
- // Decimal Constants
65
- // ============================================================================
66
- /**
67
- * MYX API returns prices as normal floating-point strings (e.g. "64854.76").
68
- * No decimal scaling is needed for prices from the REST/WS API.
69
- *
70
- * Note: The SDK's internal contract layer uses 30 decimals, but the API
71
- * endpoints (tickers, candles, order history) return human-readable values.
72
- */
73
- exports.MYX_PRICE_DECIMALS = 0;
74
- /**
75
- * MYX uses 18 decimals for position sizes
76
- */
77
- exports.MYX_SIZE_DECIMALS = 18;
78
- /**
79
- * MYX uses 18 decimals for collateral amounts (USDT on BNB)
80
- */
81
- exports.MYX_COLLATERAL_DECIMALS = 18;
82
- // ============================================================================
83
- // Token Addresses
84
- // ============================================================================
85
- /**
86
- * Collateral token address — testnet (USDC on Linea Sepolia)
87
- * From SDK: LINEA_SEPOLIA.USDC
88
- */
89
- exports.MYX_COLLATERAL_TOKEN_TESTNET = '0xD984fd34f91F92DA0586e1bE82E262fF27DC431b';
90
- /**
91
- * Collateral token address — mainnet (BUSD on BNB, per pool quoteToken)
92
- * Note: individual pools may use different quote tokens
93
- */
94
- exports.MYX_COLLATERAL_TOKEN_MAINNET = '0x8bfc51e1928e91e47c6734983ac018b2fc0adf4e';
95
- /** @deprecated Use MYX_COLLATERAL_TOKEN_TESTNET */
96
- exports.USDT_BNB_TESTNET = exports.MYX_COLLATERAL_TOKEN_TESTNET;
97
- /** @deprecated Use MYX_COLLATERAL_TOKEN_MAINNET */
98
- exports.USDT_BNB_MAINNET = exports.MYX_COLLATERAL_TOKEN_MAINNET;
99
- /**
100
- * Collateral token configuration by network
101
- */
102
- exports.MYX_ASSET_CONFIGS = {
103
- USDT: {
104
- mainnet: {
105
- chainId: exports.MYX_MAINNET_CAIP_CHAIN_ID,
106
- tokenAddress: exports.MYX_COLLATERAL_TOKEN_MAINNET,
107
- },
108
- testnet: {
109
- chainId: exports.MYX_TESTNET_CAIP_CHAIN_ID,
110
- tokenAddress: exports.MYX_COLLATERAL_TOKEN_TESTNET,
111
- },
112
- },
113
- };
114
- // ============================================================================
115
- // Decimal Conversion Helpers
116
- // ============================================================================
117
- /**
118
- * Convert MYX API price string to standard number.
119
- *
120
- * MYX API returns normal floating-point price strings (e.g. "64854.76"),
121
- * NOT 30-decimal scaled integers. This is a simple parseFloat.
122
- *
123
- * @param myxPrice - Price string from MYX API (e.g. "64854.760266796727")
124
- * @returns Standard decimal number
125
- */
126
- function fromMYXPrice(myxPrice) {
127
- if (!myxPrice || myxPrice === '0') {
128
- return 0;
129
- }
130
- const parsed = parseFloat(myxPrice);
131
- return isNaN(parsed) ? 0 : parsed;
132
- }
133
- exports.fromMYXPrice = fromMYXPrice;
134
- /**
135
- * Convert standard number to MYX API price string.
136
- *
137
- * MYX API uses normal floating-point strings, so this is a simple toString.
138
- *
139
- * @param price - Standard decimal number
140
- * @returns Price string for MYX API
141
- */
142
- function toMYXPrice(price) {
143
- const parsed = typeof price === 'string' ? parseFloat(price) : price;
144
- return isNaN(parsed) ? '0' : parsed.toString();
145
- }
146
- exports.toMYXPrice = toMYXPrice;
147
- /**
148
- * Convert MYX SDK size (18 decimals) to standard number
149
- *
150
- * @param myxSize - Size string in 18-decimal format from SDK
151
- * @returns Standard decimal number
152
- */
153
- function fromMYXSize(myxSize) {
154
- if (!myxSize || myxSize === '0') {
155
- return 0;
156
- }
157
- try {
158
- const bn = new bignumber_js_1.BigNumber(myxSize);
159
- if (bn.isNaN()) {
160
- return 0;
161
- }
162
- const divisor = new bignumber_js_1.BigNumber(10).pow(exports.MYX_SIZE_DECIMALS);
163
- return bn.dividedBy(divisor).toNumber();
164
- }
165
- catch {
166
- return 0;
167
- }
168
- }
169
- exports.fromMYXSize = fromMYXSize;
170
- /**
171
- * Convert standard number to MYX SDK size format (18 decimals)
172
- *
173
- * @param size - Standard decimal number
174
- * @returns Size string in 18-decimal format for SDK
175
- */
176
- function toMYXSize(size) {
177
- try {
178
- const bn = new bignumber_js_1.BigNumber(size);
179
- if (bn.isNaN()) {
180
- return '0';
181
- }
182
- const multiplier = new bignumber_js_1.BigNumber(10).pow(exports.MYX_SIZE_DECIMALS);
183
- return bn.multipliedBy(multiplier).toFixed(0);
184
- }
185
- catch {
186
- return '0';
187
- }
188
- }
189
- exports.toMYXSize = toMYXSize;
190
- /**
191
- * Convert MYX SDK collateral (18 decimals) to standard number
192
- *
193
- * @param myxCollateral - Collateral string in 18-decimal format from SDK
194
- * @returns Standard decimal number
195
- */
196
- function fromMYXCollateral(myxCollateral) {
197
- if (!myxCollateral || myxCollateral === '0') {
198
- return 0;
199
- }
200
- try {
201
- const bn = new bignumber_js_1.BigNumber(myxCollateral);
202
- if (bn.isNaN()) {
203
- return 0;
204
- }
205
- const divisor = new bignumber_js_1.BigNumber(10).pow(exports.MYX_COLLATERAL_DECIMALS);
206
- return bn.dividedBy(divisor).toNumber();
207
- }
208
- catch {
209
- return 0;
210
- }
211
- }
212
- exports.fromMYXCollateral = fromMYXCollateral;
213
- // ============================================================================
214
- // REST API Configuration
215
- // ============================================================================
216
- /**
217
- * Price polling interval in milliseconds
218
- * Using 5 seconds as a fallback for unreliable WebSocket
219
- */
220
- exports.MYX_PRICE_POLLING_INTERVAL_MS = 5000;
221
- /**
222
- * HTTP request timeout in milliseconds
223
- */
224
- exports.MYX_HTTP_TIMEOUT_MS = 10000;
225
- /**
226
- * Maximum retries for failed API requests
227
- */
228
- exports.MYX_MAX_RETRIES = 3;
229
- /**
230
- * Default slippage in basis points for MYX orders (1% — matches SDK default)
231
- */
232
- exports.MYX_DEFAULT_SLIPPAGE_BPS = 100;
233
- /**
234
- * Maximum leverage supported by MYX (most markets)
235
- */
236
- exports.MYX_MAX_LEVERAGE = 100;
237
- /**
238
- * Minimum order size in USD
239
- */
240
- exports.MYX_MINIMUM_ORDER_SIZE_USD = 10;
241
- /**
242
- * MYX fee rates (placeholder — will be replaced with per-market rates)
243
- */
244
- exports.MYX_FEE_RATE = 0.0005; // 0.05% total fee rate
245
- exports.MYX_PROTOCOL_FEE_RATE = 0.0005; // Protocol taker fee
246
- /**
247
- * USDT execution fee token address per network (used for order execution fees)
248
- */
249
- exports.MYX_EXECUTION_FEE_TOKEN = {
250
- testnet: exports.MYX_COLLATERAL_TOKEN_TESTNET,
251
- mainnet: exports.MYX_COLLATERAL_TOKEN_MAINNET,
252
- };
253
- //# sourceMappingURL=myxConfig.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"myxConfig.cjs","sourceRoot":"","sources":["../../src/constants/myxConfig.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,+CAAyC;AAQzC,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG,IAAa,CAAC;AACrC,QAAA,oBAAoB,GAAG,OAAgB,CAAC;AACxC,QAAA,yBAAyB,GACpC,UAAU,4BAAoB,EAAiB,CAAC;AACrC,QAAA,yBAAyB,GACpC,UAAU,4BAAoB,EAAiB,CAAC;AAElD;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,OAAmB;IAC/C,OAAO,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,QAAQ,CAAC,4BAAoB,EAAE,EAAE,CAAC;QACpC,CAAC,CAAC,QAAQ,CAAC,4BAAoB,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC;AAJD,sCAIC;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;GAEG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,CAAC,uBAAuB;AAC9C,QAAA,qBAAqB,GAAG,MAAM,CAAC,CAAC,qBAAqB;AAElE;;GAEG;AACU,QAAA,uBAAuB,GAA+B;IACjE,OAAO,EAAE,oCAA4B;IACrC,OAAO,EAAE,oCAA4B;CACtC,CAAC","sourcesContent":["/**\n * MYX Protocol Configuration Constants\n *\n * Configuration for market display, price fetching, and trading.\n * Based on MYX SDK patterns.\n */\n\nimport type { CaipChainId } from '@metamask/utils';\nimport { BigNumber } from 'bignumber.js';\n\nimport type {\n MYXNetwork,\n MYXEndpoints,\n MYXAssetConfigs,\n} from '../types/myx-types.js';\n\n// ============================================================================\n// Network Constants\n// ============================================================================\n\n/**\n * MYX Chain IDs\n * Mainnet: BNB Chain (56)\n * Testnet: Linea Sepolia (59141) — primary testnet chain with most active pools.\n * The testnet API also has one pool on Arbitrum Sepolia (421614) but it has no\n * ticker data, so Linea Sepolia is the effective testnet chain.\n */\nexport const MYX_MAINNET_CHAIN_ID = '56' as const;\nexport const MYX_TESTNET_CHAIN_ID = '59141' as const;\nexport const MYX_MAINNET_CAIP_CHAIN_ID =\n `eip155:${MYX_MAINNET_CHAIN_ID}` as CaipChainId;\nexport const MYX_TESTNET_CAIP_CHAIN_ID =\n `eip155:${MYX_TESTNET_CHAIN_ID}` as CaipChainId;\n\n/**\n * Get numeric chain ID for MYX network\n *\n * @param network - The MYX network environment (mainnet or testnet).\n * @returns The numeric chain ID for the specified network.\n */\nexport function getMYXChainId(network: MYXNetwork): number {\n return network === 'testnet'\n ? parseInt(MYX_TESTNET_CHAIN_ID, 10)\n : parseInt(MYX_MAINNET_CHAIN_ID, 10);\n}\n\n// ============================================================================\n// API Endpoints\n// ============================================================================\n\n/**\n * MYX REST and WebSocket endpoints\n */\nexport const MYX_ENDPOINTS: MYXEndpoints = {\n mainnet: {\n http: 'https://api.myx.finance',\n ws: 'wss://oapi.myx.finance/ws',\n },\n testnet: {\n http: 'https://api-test.myx.cash',\n ws: 'wss://oapi-test.myx.cash/ws',\n },\n};\n\n/**\n * Get HTTP endpoint for network\n *\n * @param network - The MYX network environment (mainnet or testnet).\n * @returns The HTTP API endpoint URL for the specified network.\n */\nexport function getMYXHttpEndpoint(network: MYXNetwork): string {\n return MYX_ENDPOINTS[network].http;\n}\n\n// ============================================================================\n// Decimal Constants\n// ============================================================================\n\n/**\n * MYX API returns prices as normal floating-point strings (e.g. \"64854.76\").\n * No decimal scaling is needed for prices from the REST/WS API.\n *\n * Note: The SDK's internal contract layer uses 30 decimals, but the API\n * endpoints (tickers, candles, order history) return human-readable values.\n */\nexport const MYX_PRICE_DECIMALS = 0;\n\n/**\n * MYX uses 18 decimals for position sizes\n */\nexport const MYX_SIZE_DECIMALS = 18;\n\n/**\n * MYX uses 18 decimals for collateral amounts (USDT on BNB)\n */\nexport const MYX_COLLATERAL_DECIMALS = 18;\n\n// ============================================================================\n// Token Addresses\n// ============================================================================\n\n/**\n * Collateral token address — testnet (USDC on Linea Sepolia)\n * From SDK: LINEA_SEPOLIA.USDC\n */\nexport const MYX_COLLATERAL_TOKEN_TESTNET =\n '0xD984fd34f91F92DA0586e1bE82E262fF27DC431b' as const;\n\n/**\n * Collateral token address — mainnet (BUSD on BNB, per pool quoteToken)\n * Note: individual pools may use different quote tokens\n */\nexport const MYX_COLLATERAL_TOKEN_MAINNET =\n '0x8bfc51e1928e91e47c6734983ac018b2fc0adf4e' as const;\n\n/** @deprecated Use MYX_COLLATERAL_TOKEN_TESTNET */\nexport const USDT_BNB_TESTNET = MYX_COLLATERAL_TOKEN_TESTNET;\n/** @deprecated Use MYX_COLLATERAL_TOKEN_MAINNET */\nexport const USDT_BNB_MAINNET = MYX_COLLATERAL_TOKEN_MAINNET;\n\n/**\n * Collateral token configuration by network\n */\nexport const MYX_ASSET_CONFIGS: MYXAssetConfigs = {\n USDT: {\n mainnet: {\n chainId: MYX_MAINNET_CAIP_CHAIN_ID,\n tokenAddress: MYX_COLLATERAL_TOKEN_MAINNET,\n },\n testnet: {\n chainId: MYX_TESTNET_CAIP_CHAIN_ID,\n tokenAddress: MYX_COLLATERAL_TOKEN_TESTNET,\n },\n },\n};\n\n// ============================================================================\n// Decimal Conversion Helpers\n// ============================================================================\n\n/**\n * Convert MYX API price string to standard number.\n *\n * MYX API returns normal floating-point price strings (e.g. \"64854.76\"),\n * NOT 30-decimal scaled integers. This is a simple parseFloat.\n *\n * @param myxPrice - Price string from MYX API (e.g. \"64854.760266796727\")\n * @returns Standard decimal number\n */\nexport function fromMYXPrice(myxPrice: string): number {\n if (!myxPrice || myxPrice === '0') {\n return 0;\n }\n\n const parsed = parseFloat(myxPrice);\n return isNaN(parsed) ? 0 : parsed;\n}\n\n/**\n * Convert standard number to MYX API price string.\n *\n * MYX API uses normal floating-point strings, so this is a simple toString.\n *\n * @param price - Standard decimal number\n * @returns Price string for MYX API\n */\nexport function toMYXPrice(price: number | string): string {\n const parsed = typeof price === 'string' ? parseFloat(price) : price;\n return isNaN(parsed) ? '0' : parsed.toString();\n}\n\n/**\n * Convert MYX SDK size (18 decimals) to standard number\n *\n * @param myxSize - Size string in 18-decimal format from SDK\n * @returns Standard decimal number\n */\nexport function fromMYXSize(myxSize: string): number {\n if (!myxSize || myxSize === '0') {\n return 0;\n }\n\n try {\n const bn = new BigNumber(myxSize);\n if (bn.isNaN()) {\n return 0;\n }\n const divisor = new BigNumber(10).pow(MYX_SIZE_DECIMALS);\n return bn.dividedBy(divisor).toNumber();\n } catch {\n return 0;\n }\n}\n\n/**\n * Convert standard number to MYX SDK size format (18 decimals)\n *\n * @param size - Standard decimal number\n * @returns Size string in 18-decimal format for SDK\n */\nexport function toMYXSize(size: number | string): string {\n try {\n const bn = new BigNumber(size);\n if (bn.isNaN()) {\n return '0';\n }\n const multiplier = new BigNumber(10).pow(MYX_SIZE_DECIMALS);\n return bn.multipliedBy(multiplier).toFixed(0);\n } catch {\n return '0';\n }\n}\n\n/**\n * Convert MYX SDK collateral (18 decimals) to standard number\n *\n * @param myxCollateral - Collateral string in 18-decimal format from SDK\n * @returns Standard decimal number\n */\nexport function fromMYXCollateral(myxCollateral: string): number {\n if (!myxCollateral || myxCollateral === '0') {\n return 0;\n }\n\n try {\n const bn = new BigNumber(myxCollateral);\n if (bn.isNaN()) {\n return 0;\n }\n const divisor = new BigNumber(10).pow(MYX_COLLATERAL_DECIMALS);\n return bn.dividedBy(divisor).toNumber();\n } catch {\n return 0;\n }\n}\n\n// ============================================================================\n// REST API Configuration\n// ============================================================================\n\n/**\n * Price polling interval in milliseconds\n * Using 5 seconds as a fallback for unreliable WebSocket\n */\nexport const MYX_PRICE_POLLING_INTERVAL_MS = 5000;\n\n/**\n * HTTP request timeout in milliseconds\n */\nexport const MYX_HTTP_TIMEOUT_MS = 10000;\n\n/**\n * Maximum retries for failed API requests\n */\nexport const MYX_MAX_RETRIES = 3;\n\n/**\n * Default slippage in basis points for MYX orders (1% — matches SDK default)\n */\nexport const MYX_DEFAULT_SLIPPAGE_BPS = 100;\n\n/**\n * Maximum leverage supported by MYX (most markets)\n */\nexport const MYX_MAX_LEVERAGE = 100;\n\n/**\n * Minimum order size in USD\n */\nexport const MYX_MINIMUM_ORDER_SIZE_USD = 10;\n\n/**\n * MYX fee rates (placeholder — will be replaced with per-market rates)\n */\nexport const MYX_FEE_RATE = 0.0005; // 0.05% total fee rate\nexport const MYX_PROTOCOL_FEE_RATE = 0.0005; // Protocol taker fee\n\n/**\n * USDT execution fee token address per network (used for order execution fees)\n */\nexport const MYX_EXECUTION_FEE_TOKEN: Record<MYXNetwork, string> = {\n testnet: MYX_COLLATERAL_TOKEN_TESTNET,\n mainnet: MYX_COLLATERAL_TOKEN_MAINNET,\n};\n"]}
@@ -1,145 +0,0 @@
1
- /**
2
- * MYX Protocol Configuration Constants
3
- *
4
- * Configuration for market display, price fetching, and trading.
5
- * Based on MYX SDK patterns.
6
- */
7
- import type { MYXNetwork, MYXEndpoints, MYXAssetConfigs } from "../types/myx-types.cjs";
8
- /**
9
- * MYX Chain IDs
10
- * Mainnet: BNB Chain (56)
11
- * Testnet: Linea Sepolia (59141) — primary testnet chain with most active pools.
12
- * The testnet API also has one pool on Arbitrum Sepolia (421614) but it has no
13
- * ticker data, so Linea Sepolia is the effective testnet chain.
14
- */
15
- export declare const MYX_MAINNET_CHAIN_ID: "56";
16
- export declare const MYX_TESTNET_CHAIN_ID: "59141";
17
- export declare const MYX_MAINNET_CAIP_CHAIN_ID: `${string}:${string}`;
18
- export declare const MYX_TESTNET_CAIP_CHAIN_ID: `${string}:${string}`;
19
- /**
20
- * Get numeric chain ID for MYX network
21
- *
22
- * @param network - The MYX network environment (mainnet or testnet).
23
- * @returns The numeric chain ID for the specified network.
24
- */
25
- export declare function getMYXChainId(network: MYXNetwork): number;
26
- /**
27
- * MYX REST and WebSocket endpoints
28
- */
29
- export declare const MYX_ENDPOINTS: MYXEndpoints;
30
- /**
31
- * Get HTTP endpoint for network
32
- *
33
- * @param network - The MYX network environment (mainnet or testnet).
34
- * @returns The HTTP API endpoint URL for the specified network.
35
- */
36
- export declare function getMYXHttpEndpoint(network: MYXNetwork): string;
37
- /**
38
- * MYX API returns prices as normal floating-point strings (e.g. "64854.76").
39
- * No decimal scaling is needed for prices from the REST/WS API.
40
- *
41
- * Note: The SDK's internal contract layer uses 30 decimals, but the API
42
- * endpoints (tickers, candles, order history) return human-readable values.
43
- */
44
- export declare const MYX_PRICE_DECIMALS = 0;
45
- /**
46
- * MYX uses 18 decimals for position sizes
47
- */
48
- export declare const MYX_SIZE_DECIMALS = 18;
49
- /**
50
- * MYX uses 18 decimals for collateral amounts (USDT on BNB)
51
- */
52
- export declare const MYX_COLLATERAL_DECIMALS = 18;
53
- /**
54
- * Collateral token address — testnet (USDC on Linea Sepolia)
55
- * From SDK: LINEA_SEPOLIA.USDC
56
- */
57
- export declare const MYX_COLLATERAL_TOKEN_TESTNET: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b";
58
- /**
59
- * Collateral token address — mainnet (BUSD on BNB, per pool quoteToken)
60
- * Note: individual pools may use different quote tokens
61
- */
62
- export declare const MYX_COLLATERAL_TOKEN_MAINNET: "0x8bfc51e1928e91e47c6734983ac018b2fc0adf4e";
63
- /** @deprecated Use MYX_COLLATERAL_TOKEN_TESTNET */
64
- export declare const USDT_BNB_TESTNET: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b";
65
- /** @deprecated Use MYX_COLLATERAL_TOKEN_MAINNET */
66
- export declare const USDT_BNB_MAINNET: "0x8bfc51e1928e91e47c6734983ac018b2fc0adf4e";
67
- /**
68
- * Collateral token configuration by network
69
- */
70
- export declare const MYX_ASSET_CONFIGS: MYXAssetConfigs;
71
- /**
72
- * Convert MYX API price string to standard number.
73
- *
74
- * MYX API returns normal floating-point price strings (e.g. "64854.76"),
75
- * NOT 30-decimal scaled integers. This is a simple parseFloat.
76
- *
77
- * @param myxPrice - Price string from MYX API (e.g. "64854.760266796727")
78
- * @returns Standard decimal number
79
- */
80
- export declare function fromMYXPrice(myxPrice: string): number;
81
- /**
82
- * Convert standard number to MYX API price string.
83
- *
84
- * MYX API uses normal floating-point strings, so this is a simple toString.
85
- *
86
- * @param price - Standard decimal number
87
- * @returns Price string for MYX API
88
- */
89
- export declare function toMYXPrice(price: number | string): string;
90
- /**
91
- * Convert MYX SDK size (18 decimals) to standard number
92
- *
93
- * @param myxSize - Size string in 18-decimal format from SDK
94
- * @returns Standard decimal number
95
- */
96
- export declare function fromMYXSize(myxSize: string): number;
97
- /**
98
- * Convert standard number to MYX SDK size format (18 decimals)
99
- *
100
- * @param size - Standard decimal number
101
- * @returns Size string in 18-decimal format for SDK
102
- */
103
- export declare function toMYXSize(size: number | string): string;
104
- /**
105
- * Convert MYX SDK collateral (18 decimals) to standard number
106
- *
107
- * @param myxCollateral - Collateral string in 18-decimal format from SDK
108
- * @returns Standard decimal number
109
- */
110
- export declare function fromMYXCollateral(myxCollateral: string): number;
111
- /**
112
- * Price polling interval in milliseconds
113
- * Using 5 seconds as a fallback for unreliable WebSocket
114
- */
115
- export declare const MYX_PRICE_POLLING_INTERVAL_MS = 5000;
116
- /**
117
- * HTTP request timeout in milliseconds
118
- */
119
- export declare const MYX_HTTP_TIMEOUT_MS = 10000;
120
- /**
121
- * Maximum retries for failed API requests
122
- */
123
- export declare const MYX_MAX_RETRIES = 3;
124
- /**
125
- * Default slippage in basis points for MYX orders (1% — matches SDK default)
126
- */
127
- export declare const MYX_DEFAULT_SLIPPAGE_BPS = 100;
128
- /**
129
- * Maximum leverage supported by MYX (most markets)
130
- */
131
- export declare const MYX_MAX_LEVERAGE = 100;
132
- /**
133
- * Minimum order size in USD
134
- */
135
- export declare const MYX_MINIMUM_ORDER_SIZE_USD = 10;
136
- /**
137
- * MYX fee rates (placeholder — will be replaced with per-market rates)
138
- */
139
- export declare const MYX_FEE_RATE = 0.0005;
140
- export declare const MYX_PROTOCOL_FEE_RATE = 0.0005;
141
- /**
142
- * USDT execution fee token address per network (used for order execution fees)
143
- */
144
- export declare const MYX_EXECUTION_FEE_TOKEN: Record<MYXNetwork, string>;
145
- //# sourceMappingURL=myxConfig.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"myxConfig.d.cts","sourceRoot":"","sources":["../../src/constants/myxConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,eAAe,EAChB,+BAA8B;AAM/B;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,MAAgB,CAAC;AAClD,eAAO,MAAM,oBAAoB,SAAmB,CAAC;AACrD,eAAO,MAAM,yBAAyB,uBACW,CAAC;AAClD,eAAO,MAAM,yBAAyB,uBACW,CAAC;AAElD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAIzD;AAMD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YAS3B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,U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S,CAAC;AACnC,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAG9D,CAAC"}
@@ -1,145 +0,0 @@
1
- /**
2
- * MYX Protocol Configuration Constants
3
- *
4
- * Configuration for market display, price fetching, and trading.
5
- * Based on MYX SDK patterns.
6
- */
7
- import type { MYXNetwork, MYXEndpoints, MYXAssetConfigs } from "../types/myx-types.mjs";
8
- /**
9
- * MYX Chain IDs
10
- * Mainnet: BNB Chain (56)
11
- * Testnet: Linea Sepolia (59141) — primary testnet chain with most active pools.
12
- * The testnet API also has one pool on Arbitrum Sepolia (421614) but it has no
13
- * ticker data, so Linea Sepolia is the effective testnet chain.
14
- */
15
- export declare const MYX_MAINNET_CHAIN_ID: "56";
16
- export declare const MYX_TESTNET_CHAIN_ID: "59141";
17
- export declare const MYX_MAINNET_CAIP_CHAIN_ID: `${string}:${string}`;
18
- export declare const MYX_TESTNET_CAIP_CHAIN_ID: `${string}:${string}`;
19
- /**
20
- * Get numeric chain ID for MYX network
21
- *
22
- * @param network - The MYX network environment (mainnet or testnet).
23
- * @returns The numeric chain ID for the specified network.
24
- */
25
- export declare function getMYXChainId(network: MYXNetwork): number;
26
- /**
27
- * MYX REST and WebSocket endpoints
28
- */
29
- export declare const MYX_ENDPOINTS: MYXEndpoints;
30
- /**
31
- * Get HTTP endpoint for network
32
- *
33
- * @param network - The MYX network environment (mainnet or testnet).
34
- * @returns The HTTP API endpoint URL for the specified network.
35
- */
36
- export declare function getMYXHttpEndpoint(network: MYXNetwork): string;
37
- /**
38
- * MYX API returns prices as normal floating-point strings (e.g. "64854.76").
39
- * No decimal scaling is needed for prices from the REST/WS API.
40
- *
41
- * Note: The SDK's internal contract layer uses 30 decimals, but the API
42
- * endpoints (tickers, candles, order history) return human-readable values.
43
- */
44
- export declare const MYX_PRICE_DECIMALS = 0;
45
- /**
46
- * MYX uses 18 decimals for position sizes
47
- */
48
- export declare const MYX_SIZE_DECIMALS = 18;
49
- /**
50
- * MYX uses 18 decimals for collateral amounts (USDT on BNB)
51
- */
52
- export declare const MYX_COLLATERAL_DECIMALS = 18;
53
- /**
54
- * Collateral token address — testnet (USDC on Linea Sepolia)
55
- * From SDK: LINEA_SEPOLIA.USDC
56
- */
57
- export declare const MYX_COLLATERAL_TOKEN_TESTNET: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b";
58
- /**
59
- * Collateral token address — mainnet (BUSD on BNB, per pool quoteToken)
60
- * Note: individual pools may use different quote tokens
61
- */
62
- export declare const MYX_COLLATERAL_TOKEN_MAINNET: "0x8bfc51e1928e91e47c6734983ac018b2fc0adf4e";
63
- /** @deprecated Use MYX_COLLATERAL_TOKEN_TESTNET */
64
- export declare const USDT_BNB_TESTNET: "0xD984fd34f91F92DA0586e1bE82E262fF27DC431b";
65
- /** @deprecated Use MYX_COLLATERAL_TOKEN_MAINNET */
66
- export declare const USDT_BNB_MAINNET: "0x8bfc51e1928e91e47c6734983ac018b2fc0adf4e";
67
- /**
68
- * Collateral token configuration by network
69
- */
70
- export declare const MYX_ASSET_CONFIGS: MYXAssetConfigs;
71
- /**
72
- * Convert MYX API price string to standard number.
73
- *
74
- * MYX API returns normal floating-point price strings (e.g. "64854.76"),
75
- * NOT 30-decimal scaled integers. This is a simple parseFloat.
76
- *
77
- * @param myxPrice - Price string from MYX API (e.g. "64854.760266796727")
78
- * @returns Standard decimal number
79
- */
80
- export declare function fromMYXPrice(myxPrice: string): number;
81
- /**
82
- * Convert standard number to MYX API price string.
83
- *
84
- * MYX API uses normal floating-point strings, so this is a simple toString.
85
- *
86
- * @param price - Standard decimal number
87
- * @returns Price string for MYX API
88
- */
89
- export declare function toMYXPrice(price: number | string): string;
90
- /**
91
- * Convert MYX SDK size (18 decimals) to standard number
92
- *
93
- * @param myxSize - Size string in 18-decimal format from SDK
94
- * @returns Standard decimal number
95
- */
96
- export declare function fromMYXSize(myxSize: string): number;
97
- /**
98
- * Convert standard number to MYX SDK size format (18 decimals)
99
- *
100
- * @param size - Standard decimal number
101
- * @returns Size string in 18-decimal format for SDK
102
- */
103
- export declare function toMYXSize(size: number | string): string;
104
- /**
105
- * Convert MYX SDK collateral (18 decimals) to standard number
106
- *
107
- * @param myxCollateral - Collateral string in 18-decimal format from SDK
108
- * @returns Standard decimal number
109
- */
110
- export declare function fromMYXCollateral(myxCollateral: string): number;
111
- /**
112
- * Price polling interval in milliseconds
113
- * Using 5 seconds as a fallback for unreliable WebSocket
114
- */
115
- export declare const MYX_PRICE_POLLING_INTERVAL_MS = 5000;
116
- /**
117
- * HTTP request timeout in milliseconds
118
- */
119
- export declare const MYX_HTTP_TIMEOUT_MS = 10000;
120
- /**
121
- * Maximum retries for failed API requests
122
- */
123
- export declare const MYX_MAX_RETRIES = 3;
124
- /**
125
- * Default slippage in basis points for MYX orders (1% — matches SDK default)
126
- */
127
- export declare const MYX_DEFAULT_SLIPPAGE_BPS = 100;
128
- /**
129
- * Maximum leverage supported by MYX (most markets)
130
- */
131
- export declare const MYX_MAX_LEVERAGE = 100;
132
- /**
133
- * Minimum order size in USD
134
- */
135
- export declare const MYX_MINIMUM_ORDER_SIZE_USD = 10;
136
- /**
137
- * MYX fee rates (placeholder — will be replaced with per-market rates)
138
- */
139
- export declare const MYX_FEE_RATE = 0.0005;
140
- export declare const MYX_PROTOCOL_FEE_RATE = 0.0005;
141
- /**
142
- * USDT execution fee token address per network (used for order execution fees)
143
- */
144
- export declare const MYX_EXECUTION_FEE_TOKEN: Record<MYXNetwork, string>;
145
- //# sourceMappingURL=myxConfig.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"myxConfig.d.mts","sourceRoot":"","sources":["../../src/constants/myxConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,eAAe,EAChB,+BAA8B;AAM/B;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,MAAgB,CA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