@polymarbot/shared 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/basic.js CHANGED
@@ -1,3 +1,5 @@
1
+ import "./chunk-JSBRDJBE.js";
2
+
1
3
  // src/utils/basic.ts
2
4
  function sleep(ms) {
3
5
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -0,0 +1,17 @@
1
+ // src/utils/trade-strategy/types.ts
2
+ var TradeSide = /* @__PURE__ */ ((TradeSide2) => {
3
+ TradeSide2["BUY"] = "BUY";
4
+ TradeSide2["SELL"] = "SELL";
5
+ return TradeSide2;
6
+ })(TradeSide || {});
7
+ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
8
+ OrderStatus2["LIVE"] = "LIVE";
9
+ OrderStatus2["MATCHED"] = "MATCHED";
10
+ OrderStatus2["CANCELED"] = "CANCELED";
11
+ return OrderStatus2;
12
+ })(OrderStatus || {});
13
+
14
+ export {
15
+ TradeSide,
16
+ OrderStatus
17
+ };
@@ -0,0 +1,30 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ export {
28
+ __commonJS,
29
+ __toESM
30
+ };
package/crypto.js CHANGED
@@ -1,3 +1,5 @@
1
+ import "./chunk-JSBRDJBE.js";
2
+
1
3
  // src/utils/crypto.ts
2
4
  import crypto from "crypto";
3
5
  var ALGORITHM = "aes-256-gcm";
package/index.cjs CHANGED
@@ -1,8 +1,9 @@
1
1
  module.exports = {
2
2
  ...require('./basic.cjs'),
3
3
  ...require('./crypto.cjs'),
4
- ...require('./markets/tools.cjs'),
4
+ ...require('./loadEnv.cjs'),
5
5
  ...require('./markets/types.cjs'),
6
+ ...require('./markets/utils.cjs'),
6
7
  ...require('./relayer-client.cjs'),
7
8
  ...require('./trade-strategy/normalize.cjs'),
8
9
  ...require('./trade-strategy/types.cjs'),
package/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  export * from './basic.js'
2
2
  export * from './crypto.js'
3
- export * from './markets/tools.js'
3
+ export * from './loadEnv.js'
4
4
  export * from './markets/types.js'
5
+ export * from './markets/utils.js'
5
6
  export * from './relayer-client.js'
6
7
  export * from './trade-strategy/normalize.js'
7
8
  export * from './trade-strategy/types.js'
package/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export * from './basic.js'
2
2
  export * from './crypto.js'
3
- export * from './markets/tools.js'
3
+ export * from './loadEnv.js'
4
4
  export * from './markets/types.js'
5
+ export * from './markets/utils.js'
5
6
  export * from './relayer-client.js'
6
7
  export * from './trade-strategy/normalize.js'
7
8
  export * from './trade-strategy/types.js'
package/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  export * from './basic.js'
2
2
  export * from './crypto.js'
3
- export * from './markets/tools.js'
3
+ export * from './loadEnv.js'
4
4
  export * from './markets/types.js'
5
+ export * from './markets/utils.js'
5
6
  export * from './relayer-client.js'
6
7
  export * from './trade-strategy/normalize.js'
7
8
  export * from './trade-strategy/types.js'
package/loadEnv.cjs ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/loadEnv.ts
21
+ var loadEnv_exports = {};
22
+ __export(loadEnv_exports, {
23
+ loadEnv: () => loadEnv
24
+ });
25
+ module.exports = __toCommonJS(loadEnv_exports);
26
+ var import_node_fs = require("fs");
27
+ var import_dotenv = require("dotenv");
28
+ function loadEnv(cwd = process.cwd(), extraPaths = []) {
29
+ const envPath = `${cwd}/.env`;
30
+ const envLocalPath = `${cwd}/.env.local`;
31
+ if ((0, import_node_fs.existsSync)(envPath)) {
32
+ (0, import_dotenv.config)({ path: envPath });
33
+ }
34
+ if ((0, import_node_fs.existsSync)(envLocalPath)) {
35
+ (0, import_dotenv.config)({ path: envLocalPath, override: true });
36
+ }
37
+ for (const relativePath of extraPaths) {
38
+ const fullPath = `${cwd}/${relativePath}`;
39
+ if ((0, import_node_fs.existsSync)(fullPath)) {
40
+ (0, import_dotenv.config)({ path: fullPath, override: true });
41
+ }
42
+ }
43
+ }
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ loadEnv
47
+ });
package/loadEnv.d.cts ADDED
@@ -0,0 +1,3 @@
1
+ declare function loadEnv(cwd?: string, extraPaths?: string[]): void;
2
+
3
+ export { loadEnv };
package/loadEnv.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare function loadEnv(cwd?: string, extraPaths?: string[]): void;
2
+
3
+ export { loadEnv };
package/loadEnv.js ADDED
@@ -0,0 +1,24 @@
1
+ import "./chunk-JSBRDJBE.js";
2
+
3
+ // src/utils/loadEnv.ts
4
+ import { existsSync } from "fs";
5
+ import { config as dotenvConfig } from "dotenv";
6
+ function loadEnv(cwd = process.cwd(), extraPaths = []) {
7
+ const envPath = `${cwd}/.env`;
8
+ const envLocalPath = `${cwd}/.env.local`;
9
+ if (existsSync(envPath)) {
10
+ dotenvConfig({ path: envPath });
11
+ }
12
+ if (existsSync(envLocalPath)) {
13
+ dotenvConfig({ path: envLocalPath, override: true });
14
+ }
15
+ for (const relativePath of extraPaths) {
16
+ const fullPath = `${cwd}/${relativePath}`;
17
+ if (existsSync(fullPath)) {
18
+ dotenvConfig({ path: fullPath, override: true });
19
+ }
20
+ }
21
+ }
22
+ export {
23
+ loadEnv
24
+ };
package/markets/types.js CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  SupportedInterval,
3
3
  SupportedSymbol
4
4
  } from "../chunk-S6EEUHHX.js";
5
+ import "../chunk-JSBRDJBE.js";
5
6
  export {
6
7
  SupportedInterval,
7
8
  SupportedSymbol