@diviswap/sdk 1.7.8 → 1.7.10

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 (2) hide show
  1. package/dist/cli/index.js +16 -20
  2. package/package.json +3 -2
package/dist/cli/index.js CHANGED
@@ -76,33 +76,25 @@ function getPackageRoot() {
76
76
  return process.cwd();
77
77
  }
78
78
  try {
79
- const npmBinPath = process.env.npm_execpath || "";
80
- if (npmBinPath) {
81
- const nodeModulesPath = path.dirname(path.dirname(npmBinPath));
82
- const packagePath = path.join(nodeModulesPath, "@99darwin", "diviswap-sdk");
83
- if (fs.existsSync(path.join(packagePath, "dist", "cli", "templates"))) {
84
- return packagePath;
85
- }
79
+ const packageJsonPath = __require.resolve("@diviswap/sdk/package.json");
80
+ const packageRoot = path.dirname(packageJsonPath);
81
+ if (fs.existsSync(path.join(packageRoot, "dist", "cli", "templates"))) {
82
+ return packageRoot;
86
83
  }
87
84
  } catch {
88
85
  }
89
86
  const cwd = process.cwd();
90
87
  const pathsToCheck = [
91
- path.join(cwd, "node_modules", "@99darwin", "diviswap-sdk"),
92
- path.join(path.dirname(cwd), "node_modules", "@99darwin", "diviswap-sdk"),
93
- path.join(path.dirname(path.dirname(cwd)), "node_modules", "@99darwin", "diviswap-sdk")
88
+ path.join(cwd, "node_modules", "@diviswap", "sdk"),
89
+ path.join(path.dirname(cwd), "node_modules", "@diviswap", "sdk"),
90
+ path.join(path.dirname(path.dirname(cwd)), "node_modules", "@diviswap", "sdk")
94
91
  ];
95
92
  for (const packagePath of pathsToCheck) {
96
93
  if (fs.existsSync(path.join(packagePath, "dist", "cli", "templates"))) {
97
94
  return packagePath;
98
95
  }
99
96
  }
100
- try {
101
- const packageJsonPath = __require.resolve("@diviswap/sdk/package.json");
102
- return path.dirname(packageJsonPath);
103
- } catch {
104
- return path.join(cwd, "node_modules", "@99darwin", "diviswap-sdk");
105
- }
97
+ return path.join(cwd, "node_modules", "@diviswap", "sdk");
106
98
  }
107
99
 
108
100
  // src/cli/templates/index.ts
@@ -361,6 +353,9 @@ function httpsRequest(url, options) {
361
353
  req.destroy();
362
354
  reject(new Error("Request timeout"));
363
355
  });
356
+ if (options.body) {
357
+ req.write(options.body);
358
+ }
364
359
  req.end();
365
360
  });
366
361
  }
@@ -368,8 +363,8 @@ async function validatePartnerCredentials(keyId, secretKey, authMethod = "hmac",
368
363
  try {
369
364
  const apiUrl = environment === "sandbox" ? "https://dev-api.liberex.sv" : "https://api.liberex.sv";
370
365
  const testPath = "/api/v1/fees";
371
- const method = "GET";
372
- const body = "";
366
+ const method = "POST";
367
+ const body = "{}";
373
368
  let headers = {
374
369
  "Content-Type": "application/json",
375
370
  "X-Client-Id": keyId
@@ -384,8 +379,9 @@ async function validatePartnerCredentials(keyId, secretKey, authMethod = "hmac",
384
379
  const response = await httpsRequest(`${apiUrl}${testPath}`, {
385
380
  method,
386
381
  headers,
387
- timeout: 1e4
382
+ timeout: 1e4,
388
383
  // 10 second timeout
384
+ body
389
385
  });
390
386
  if (response.status === 200 || response.status === 403) {
391
387
  return {
@@ -1918,7 +1914,7 @@ async function uninstall(options = {}) {
1918
1914
  }
1919
1915
 
1920
1916
  // package.json
1921
- var version = "1.7.8";
1917
+ var version = "1.7.10";
1922
1918
 
1923
1919
  // src/cli/index.ts
1924
1920
  var program = new commander.Command();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviswap/sdk",
3
- "version": "1.7.8",
3
+ "version": "1.7.10",
4
4
  "description": "Official Diviswap SDK - Crypto rails made simple",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -25,7 +25,8 @@
25
25
  "types": "./dist/services/index.d.ts",
26
26
  "import": "./dist/services/index.mjs",
27
27
  "require": "./dist/services/index.js"
28
- }
28
+ },
29
+ "./package.json": "./package.json"
29
30
  },
30
31
  "scripts": {
31
32
  "build": "tsup && node scripts/copy-templates.js",