shogun-relay-sdk 1.2.6 → 1.2.8

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.
@@ -74,9 +74,14 @@ class IpfsModule {
74
74
  const encodedPath = fullPath.includes('/')
75
75
  ? `${encodeURIComponent(directoryCid)}/${filePath.split('/').map(p => encodeURIComponent(p)).join('/')}`
76
76
  : encodeURIComponent(fullPath);
77
- return this.client.post(`/api/v1/ipfs/api/v0/cat?arg=${encodedPath}`, null, {
77
+ // Use GET instead of POST, or send empty string instead of null to avoid JSON parser error
78
+ // IPFS API v0 cat accepts POST with empty body, but Express JSON parser fails on null
79
+ return this.client.post(`/api/v1/ipfs/api/v0/cat?arg=${encodedPath}`, "", // Empty string instead of null to avoid JSON parser error
80
+ {
78
81
  responseType: "arraybuffer",
79
- // Don't set Content-Length header - browser will block it
82
+ headers: {
83
+ "Content-Type": "application/octet-stream", // Set content type to avoid JSON parsing
84
+ },
80
85
  });
81
86
  }
82
87
  async pinAdd(cid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shogun-relay-sdk",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "SDK for interacting with Shogun Relay API - HTTP client for IPFS, deals, registry, and network operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "axios": "^1.6.0",
46
- "form-data": "^4.0.0"
46
+ "form-data": "^4.0.5"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@eslint/js": "^9.15.0",
@@ -1,20 +0,0 @@
1
- import { ApiClient } from "../client";
2
- import { OracleFeedsResponse, OracleDataResponse, OracleGlobalStatsResponse } from "../types";
3
- export declare class OracleModule {
4
- private client;
5
- constructor(client: ApiClient);
6
- /**
7
- * Get list of available oracle feeds
8
- */
9
- getFeeds(): Promise<OracleFeedsResponse>;
10
- /**
11
- * Get signed oracle data
12
- * @param feedId Feed ID
13
- * @param payment Optional x402 payment string (if feed is paid)
14
- */
15
- getData(feedId: string, payment?: string): Promise<OracleDataResponse>;
16
- /**
17
- * Get global oracle stats
18
- */
19
- getGlobalStats(): Promise<OracleGlobalStatsResponse>;
20
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OracleModule = void 0;
4
- class OracleModule {
5
- constructor(client) {
6
- this.client = client;
7
- }
8
- /**
9
- * Get list of available oracle feeds
10
- */
11
- async getFeeds() {
12
- return this.client.get("/api/v1/oracle/feeds");
13
- }
14
- /**
15
- * Get signed oracle data
16
- * @param feedId Feed ID
17
- * @param payment Optional x402 payment string (if feed is paid)
18
- */
19
- async getData(feedId, payment) {
20
- const config = {};
21
- if (payment) {
22
- config.headers = {
23
- "X-Payment": payment
24
- };
25
- }
26
- return this.client.get(`/api/v1/oracle/data/${feedId}`, config);
27
- }
28
- /**
29
- * Get global oracle stats
30
- */
31
- async getGlobalStats() {
32
- return this.client.get("/api/v1/oracle/stats/global");
33
- }
34
- }
35
- exports.OracleModule = OracleModule;