@0xmonaco/core 0.2.15 → 0.3.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 (58) hide show
  1. package/README.md +3 -3
  2. package/dist/api/applications/api.d.ts.map +1 -1
  3. package/dist/api/applications/api.js.map +1 -1
  4. package/dist/api/auth/api.d.ts.map +1 -1
  5. package/dist/api/auth/api.js.map +1 -1
  6. package/dist/api/profile/api.d.ts +49 -7
  7. package/dist/api/profile/api.d.ts.map +1 -1
  8. package/dist/api/profile/api.js +61 -8
  9. package/dist/api/profile/api.js.map +1 -1
  10. package/dist/api/trading/api.d.ts +5 -13
  11. package/dist/api/trading/api.d.ts.map +1 -1
  12. package/dist/api/trading/api.js +0 -10
  13. package/dist/api/trading/api.js.map +1 -1
  14. package/dist/api/vault/api.d.ts +2 -4
  15. package/dist/api/vault/api.d.ts.map +1 -1
  16. package/dist/api/vault/api.js +1 -3
  17. package/dist/api/vault/api.js.map +1 -1
  18. package/dist/api/websocket/base-ws-client.d.ts +1 -1
  19. package/dist/api/websocket/base-ws-client.d.ts.map +1 -1
  20. package/dist/api/websocket/base-ws-client.js +8 -7
  21. package/dist/api/websocket/base-ws-client.js.map +1 -1
  22. package/dist/api/websocket/clients/ohlcv-ws-client.d.ts +2 -3
  23. package/dist/api/websocket/clients/ohlcv-ws-client.d.ts.map +1 -1
  24. package/dist/api/websocket/clients/ohlcv-ws-client.js +4 -3
  25. package/dist/api/websocket/clients/ohlcv-ws-client.js.map +1 -1
  26. package/dist/api/websocket/clients/orderbook-ws-client.d.ts +17 -4
  27. package/dist/api/websocket/clients/orderbook-ws-client.d.ts.map +1 -1
  28. package/dist/api/websocket/clients/orderbook-ws-client.js +46 -16
  29. package/dist/api/websocket/clients/orderbook-ws-client.js.map +1 -1
  30. package/dist/api/websocket/clients/orders-ws-client.d.ts +1 -2
  31. package/dist/api/websocket/clients/orders-ws-client.d.ts.map +1 -1
  32. package/dist/api/websocket/clients/orders-ws-client.js +2 -2
  33. package/dist/api/websocket/clients/orders-ws-client.js.map +1 -1
  34. package/dist/api/websocket/index.d.ts +1 -1
  35. package/dist/api/websocket/index.d.ts.map +1 -1
  36. package/dist/api/websocket/index.js +1 -1
  37. package/dist/api/websocket/index.js.map +1 -1
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +4 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/networks.d.ts +9 -0
  43. package/dist/networks.d.ts.map +1 -1
  44. package/dist/networks.js +82 -6
  45. package/dist/networks.js.map +1 -1
  46. package/dist/sdk.d.ts +7 -0
  47. package/dist/sdk.d.ts.map +1 -1
  48. package/dist/sdk.js +25 -5
  49. package/dist/sdk.js.map +1 -1
  50. package/dist/utils/index.d.ts +2 -0
  51. package/dist/utils/index.d.ts.map +1 -0
  52. package/dist/utils/index.js +2 -0
  53. package/dist/utils/index.js.map +1 -0
  54. package/dist/utils/magnitude.d.ts +27 -0
  55. package/dist/utils/magnitude.d.ts.map +1 -0
  56. package/dist/utils/magnitude.js +32 -0
  57. package/dist/utils/magnitude.js.map +1 -0
  58. package/package.json +5 -4
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Minimum number of price buckets allowed for a magnitude
3
+ */
4
+ export declare const MIN_BUCKETS_ALLOWED = 10;
5
+ /**
6
+ * Maximum number of price buckets allowed for a magnitude
7
+ */
8
+ export declare const MAX_BUCKETS_ALLOWED = 10000000;
9
+ /**
10
+ * All possible magnitude values we support (from 0.0001 to 10000)
11
+ */
12
+ export declare const ALL_MAGNITUDES: number[];
13
+ /**
14
+ * Calculate which magnitude levels are valid for a given price.
15
+ *
16
+ * A magnitude is valid if it creates between MIN_BUCKETS_ALLOWED and MAX_BUCKETS_ALLOWED price buckets.
17
+ *
18
+ * @param currentPrice - The current market price (e.g., 50000 for BTC/USDC)
19
+ * @returns Array of valid magnitude values
20
+ *
21
+ * @example
22
+ * calculateValidMagnitudes(112000); // [0.1, 1, 10, 100, 1000, 10000]
23
+ * calculateValidMagnitudes(4200); // [0.001, 0.01, 0.1, 1, 10, 100]
24
+ * calculateValidMagnitudes(0.5); // [0.0001, 0.001, 0.01]
25
+ */
26
+ export declare const calculateValidMagnitudes: (currentPrice: number) => number[];
27
+ //# sourceMappingURL=magnitude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magnitude.d.ts","sourceRoot":"","sources":["../../src/utils/magnitude.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,mBAAmB,WAAa,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,cAAc,UAAsD,CAAC;AAElF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,GAAI,cAAc,MAAM,KAAG,MAAM,EAKrE,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Minimum number of price buckets allowed for a magnitude
3
+ */
4
+ export const MIN_BUCKETS_ALLOWED = 10;
5
+ /**
6
+ * Maximum number of price buckets allowed for a magnitude
7
+ */
8
+ export const MAX_BUCKETS_ALLOWED = 10000000;
9
+ /**
10
+ * All possible magnitude values we support (from 0.0001 to 10000)
11
+ */
12
+ export const ALL_MAGNITUDES = [0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000];
13
+ /**
14
+ * Calculate which magnitude levels are valid for a given price.
15
+ *
16
+ * A magnitude is valid if it creates between MIN_BUCKETS_ALLOWED and MAX_BUCKETS_ALLOWED price buckets.
17
+ *
18
+ * @param currentPrice - The current market price (e.g., 50000 for BTC/USDC)
19
+ * @returns Array of valid magnitude values
20
+ *
21
+ * @example
22
+ * calculateValidMagnitudes(112000); // [0.1, 1, 10, 100, 1000, 10000]
23
+ * calculateValidMagnitudes(4200); // [0.001, 0.01, 0.1, 1, 10, 100]
24
+ * calculateValidMagnitudes(0.5); // [0.0001, 0.001, 0.01]
25
+ */
26
+ export const calculateValidMagnitudes = (currentPrice) => {
27
+ return ALL_MAGNITUDES.filter((magnitude) => {
28
+ const bucketCount = Math.floor(currentPrice / magnitude);
29
+ return bucketCount >= MIN_BUCKETS_ALLOWED && bucketCount <= MAX_BUCKETS_ALLOWED;
30
+ });
31
+ };
32
+ //# sourceMappingURL=magnitude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magnitude.js","sourceRoot":"","sources":["../../src/utils/magnitude.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAU,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAElF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,YAAoB,EAAY,EAAE;IACzE,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE;QACzC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC;QACzD,OAAO,WAAW,IAAI,mBAAmB,IAAI,WAAW,IAAI,mBAAmB,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/core",
3
- "version": "0.2.15",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -12,8 +12,8 @@
12
12
  "viem": "^2.31.7"
13
13
  },
14
14
  "dependencies": {
15
- "@0xmonaco/contracts": "0.1.8",
16
- "@0xmonaco/types": "0.2.12"
15
+ "@0xmonaco/contracts": "0.3.1",
16
+ "@0xmonaco/types": "0.3.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^20.11.30",
@@ -45,6 +45,7 @@
45
45
  "test:watch": "vitest --config vitest.config.ts --watch",
46
46
  "test:watch:unit": "vitest --config tests/configs/unit.config.ts --watch",
47
47
  "test:watch:integration": "vitest --config tests/configs/integration.config.ts --watch",
48
- "test:websocket": "vitest --config tests/configs/integration.config.ts tests/integration/websocket.test.ts"
48
+ "mint:tokens": "tsx tests/scripts/mint-test-tokens.ts",
49
+ "check:balances": "tsx tests/debug/check-balances.ts"
49
50
  }
50
51
  }