shogun-relay-sdk 1.1.6 → 1.2.2

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/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import { DealsModule } from "./modules/deals";
7
7
  import { RegistryModule } from "./modules/registry";
8
8
  import { UploadsModule } from "./modules/uploads";
9
9
  import { BridgeModule } from "./modules/bridge";
10
+ import { OracleModule } from "./modules/oracle";
10
11
  export * from "./types";
11
12
  export declare class ShogunRelaySDK {
12
13
  private client;
@@ -18,6 +19,7 @@ export declare class ShogunRelaySDK {
18
19
  registry: RegistryModule;
19
20
  uploads: UploadsModule;
20
21
  bridge: BridgeModule;
22
+ oracle: OracleModule;
21
23
  constructor(config: ApiClientConfig);
22
24
  setToken(token: string): void;
23
25
  }
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ const deals_1 = require("./modules/deals");
24
24
  const registry_1 = require("./modules/registry");
25
25
  const uploads_1 = require("./modules/uploads");
26
26
  const bridge_1 = require("./modules/bridge");
27
+ const oracle_1 = require("./modules/oracle");
27
28
  // Export types
28
29
  __exportStar(require("./types"), exports);
29
30
  class ShogunRelaySDK {
@@ -37,6 +38,7 @@ class ShogunRelaySDK {
37
38
  this.registry = new registry_1.RegistryModule(this.client);
38
39
  this.uploads = new uploads_1.UploadsModule(this.client);
39
40
  this.bridge = new bridge_1.BridgeModule(this.client);
41
+ this.oracle = new oracle_1.OracleModule(this.client);
40
42
  }
41
43
  setToken(token) {
42
44
  this.client.setToken(token);
@@ -0,0 +1,20 @@
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
+ }
@@ -0,0 +1,35 @@
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;
package/dist/types.d.ts CHANGED
@@ -241,3 +241,86 @@ export interface RelaysListResponse {
241
241
  }>;
242
242
  error?: string;
243
243
  }
244
+ /**
245
+ * Supported data types for feed payloads
246
+ */
247
+ export declare enum DataType {
248
+ PRICE = 0,
249
+ STRING = 1,
250
+ JSON = 2,
251
+ BYTES = 3,
252
+ CUSTOM = 4
253
+ }
254
+ /**
255
+ * Oracle Data Feed
256
+ */
257
+ export interface OracleFeed {
258
+ feedId: string;
259
+ name: string;
260
+ priceUSDC: number;
261
+ dataType: DataType;
262
+ dataTypeName: string;
263
+ active: boolean;
264
+ schema: string;
265
+ updateFreqSecs: number;
266
+ }
267
+ /**
268
+ * Validated Oracle Packet
269
+ */
270
+ export interface OraclePacket {
271
+ feedId: string;
272
+ deadline: number;
273
+ payload: string;
274
+ signature: {
275
+ v: number;
276
+ r: string;
277
+ s: string;
278
+ };
279
+ }
280
+ /**
281
+ * Global Oracle Stats
282
+ */
283
+ export interface OracleGlobalStats {
284
+ totalAccesses: number;
285
+ totalRevenueUSDC: number;
286
+ lastAccess?: string;
287
+ accessesByFeed: Record<string, number>;
288
+ revenueByFeed: Record<string, number>;
289
+ }
290
+ /**
291
+ * Oracle Feeds Response
292
+ */
293
+ export interface OracleFeedsResponse {
294
+ success: boolean;
295
+ feeds: OracleFeed[];
296
+ relay?: string;
297
+ }
298
+ /**
299
+ * Oracle Data Response
300
+ */
301
+ export interface OracleDataResponse {
302
+ success: boolean;
303
+ packet?: OraclePacket;
304
+ data?: {
305
+ feedId: string;
306
+ feedName: string;
307
+ value: any;
308
+ timestamp: number;
309
+ };
310
+ paymentRequired?: boolean;
311
+ priceUSDC?: number;
312
+ error?: string;
313
+ paymentDetails?: {
314
+ required: boolean;
315
+ amountUSDC: number;
316
+ tiers: any[];
317
+ x402: any;
318
+ };
319
+ }
320
+ /**
321
+ * Oracle Global Stats Response
322
+ */
323
+ export interface OracleGlobalStatsResponse {
324
+ success: boolean;
325
+ stats: OracleGlobalStats;
326
+ }
package/dist/types.js CHANGED
@@ -3,3 +3,15 @@
3
3
  * Type definitions for Shogun Relay SDK
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DataType = void 0;
7
+ /**
8
+ * Supported data types for feed payloads
9
+ */
10
+ var DataType;
11
+ (function (DataType) {
12
+ DataType[DataType["PRICE"] = 0] = "PRICE";
13
+ DataType[DataType["STRING"] = 1] = "STRING";
14
+ DataType[DataType["JSON"] = 2] = "JSON";
15
+ DataType[DataType["BYTES"] = 3] = "BYTES";
16
+ DataType[DataType["CUSTOM"] = 4] = "CUSTOM";
17
+ })(DataType || (exports.DataType = DataType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shogun-relay-sdk",
3
- "version": "1.1.6",
3
+ "version": "1.2.2",
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",