@lightconexyz/lightcone-sdk 0.1.0
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/README.md +232 -0
- package/dist/api/client.d.ts +225 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +452 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/error.d.ts +58 -0
- package/dist/api/error.d.ts.map +1 -0
- package/dist/api/error.js +98 -0
- package/dist/api/error.js.map +1 -0
- package/dist/api/index.d.ts +23 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +51 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/types/admin.d.ts +49 -0
- package/dist/api/types/admin.d.ts.map +1 -0
- package/dist/api/types/admin.js +13 -0
- package/dist/api/types/admin.js.map +1 -0
- package/dist/api/types/index.d.ts +14 -0
- package/dist/api/types/index.d.ts.map +1 -0
- package/dist/api/types/index.js +13 -0
- package/dist/api/types/index.js.map +1 -0
- package/dist/api/types/market.d.ts +186 -0
- package/dist/api/types/market.d.ts.map +1 -0
- package/dist/api/types/market.js +6 -0
- package/dist/api/types/market.js.map +1 -0
- package/dist/api/types/order.d.ts +190 -0
- package/dist/api/types/order.d.ts.map +1 -0
- package/dist/api/types/order.js +6 -0
- package/dist/api/types/order.js.map +1 -0
- package/dist/api/types/orderbook.d.ts +36 -0
- package/dist/api/types/orderbook.d.ts.map +1 -0
- package/dist/api/types/orderbook.js +6 -0
- package/dist/api/types/orderbook.js.map +1 -0
- package/dist/api/types/position.d.ts +60 -0
- package/dist/api/types/position.d.ts.map +1 -0
- package/dist/api/types/position.js +6 -0
- package/dist/api/types/position.js.map +1 -0
- package/dist/api/types/price_history.d.ts +68 -0
- package/dist/api/types/price_history.d.ts.map +1 -0
- package/dist/api/types/price_history.js +13 -0
- package/dist/api/types/price_history.js.map +1 -0
- package/dist/api/types/trade.d.ts +67 -0
- package/dist/api/types/trade.d.ts.map +1 -0
- package/dist/api/types/trade.js +13 -0
- package/dist/api/types/trade.js.map +1 -0
- package/dist/api/validation.d.ts +24 -0
- package/dist/api/validation.d.ts.map +1 -0
- package/dist/api/validation.js +53 -0
- package/dist/api/validation.js.map +1 -0
- package/dist/auth.d.ts +80 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +149 -0
- package/dist/auth.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/network.d.ts +5 -0
- package/dist/network.d.ts.map +1 -0
- package/dist/network.js +8 -0
- package/dist/network.js.map +1 -0
- package/dist/program/accounts.d.ts +98 -0
- package/dist/program/accounts.d.ts.map +1 -0
- package/dist/program/accounts.js +319 -0
- package/dist/program/accounts.js.map +1 -0
- package/dist/program/builder.d.ts +94 -0
- package/dist/program/builder.d.ts.map +1 -0
- package/dist/program/builder.js +175 -0
- package/dist/program/builder.js.map +1 -0
- package/dist/program/client.d.ts +56 -0
- package/dist/program/client.d.ts.map +1 -0
- package/dist/program/client.js +288 -0
- package/dist/program/client.js.map +1 -0
- package/dist/program/constants.d.ts +108 -0
- package/dist/program/constants.d.ts.map +1 -0
- package/dist/program/constants.js +112 -0
- package/dist/program/constants.js.map +1 -0
- package/dist/program/index.d.ts +14 -0
- package/dist/program/index.d.ts.map +1 -0
- package/dist/program/index.js +149 -0
- package/dist/program/index.js.map +1 -0
- package/dist/program/instructions.d.ts +248 -0
- package/dist/program/instructions.d.ts.map +1 -0
- package/dist/program/instructions.js +692 -0
- package/dist/program/instructions.js.map +1 -0
- package/dist/program/orders.d.ts +151 -0
- package/dist/program/orders.d.ts.map +1 -0
- package/dist/program/orders.js +417 -0
- package/dist/program/orders.js.map +1 -0
- package/dist/program/pda.d.ts +73 -0
- package/dist/program/pda.d.ts.map +1 -0
- package/dist/program/pda.js +131 -0
- package/dist/program/pda.js.map +1 -0
- package/dist/program/types.d.ts +380 -0
- package/dist/program/types.d.ts.map +1 -0
- package/dist/program/types.js +27 -0
- package/dist/program/types.js.map +1 -0
- package/dist/program/utils.d.ts +91 -0
- package/dist/program/utils.d.ts.map +1 -0
- package/dist/program/utils.js +219 -0
- package/dist/program/utils.js.map +1 -0
- package/dist/shared/index.d.ts +8 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +18 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/price.d.ts +41 -0
- package/dist/shared/price.d.ts.map +1 -0
- package/dist/shared/price.js +57 -0
- package/dist/shared/price.js.map +1 -0
- package/dist/shared/scaling.d.ts +45 -0
- package/dist/shared/scaling.d.ts.map +1 -0
- package/dist/shared/scaling.js +84 -0
- package/dist/shared/scaling.js.map +1 -0
- package/dist/shared/types.d.ts +19 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +23 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/websocket/client.d.ts +238 -0
- package/dist/websocket/client.d.ts.map +1 -0
- package/dist/websocket/client.js +580 -0
- package/dist/websocket/client.js.map +1 -0
- package/dist/websocket/error.d.ts +47 -0
- package/dist/websocket/error.d.ts.map +1 -0
- package/dist/websocket/error.js +83 -0
- package/dist/websocket/error.js.map +1 -0
- package/dist/websocket/handlers.d.ts +97 -0
- package/dist/websocket/handlers.d.ts.map +1 -0
- package/dist/websocket/handlers.js +277 -0
- package/dist/websocket/handlers.js.map +1 -0
- package/dist/websocket/index.d.ts +38 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/dist/websocket/index.js +75 -0
- package/dist/websocket/index.js.map +1 -0
- package/dist/websocket/state/index.d.ts +7 -0
- package/dist/websocket/state/index.d.ts.map +1 -0
- package/dist/websocket/state/index.js +14 -0
- package/dist/websocket/state/index.js.map +1 -0
- package/dist/websocket/state/orderbook.d.ts +107 -0
- package/dist/websocket/state/orderbook.d.ts.map +1 -0
- package/dist/websocket/state/orderbook.js +293 -0
- package/dist/websocket/state/orderbook.js.map +1 -0
- package/dist/websocket/state/price.d.ts +108 -0
- package/dist/websocket/state/price.d.ts.map +1 -0
- package/dist/websocket/state/price.js +243 -0
- package/dist/websocket/state/price.js.map +1 -0
- package/dist/websocket/state/user.d.ts +83 -0
- package/dist/websocket/state/user.d.ts.map +1 -0
- package/dist/websocket/state/user.js +228 -0
- package/dist/websocket/state/user.js.map +1 -0
- package/dist/websocket/subscriptions.d.ts +143 -0
- package/dist/websocket/subscriptions.d.ts.map +1 -0
- package/dist/websocket/subscriptions.js +244 -0
- package/dist/websocket/subscriptions.js.map +1 -0
- package/dist/websocket/types.d.ts +417 -0
- package/dist/websocket/types.d.ts.map +1 -0
- package/dist/websocket/types.js +195 -0
- package/dist/websocket/types.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API error types for the Lightcone REST API client.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ApiError = void 0;
|
|
7
|
+
exports.getErrorMessage = getErrorMessage;
|
|
8
|
+
/**
|
|
9
|
+
* API-specific error class for the Lightcone REST API client.
|
|
10
|
+
*/
|
|
11
|
+
class ApiError extends Error {
|
|
12
|
+
variant;
|
|
13
|
+
statusCode;
|
|
14
|
+
details;
|
|
15
|
+
constructor(variant, message, statusCode, details) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = "ApiError";
|
|
18
|
+
this.variant = variant;
|
|
19
|
+
this.statusCode = statusCode;
|
|
20
|
+
this.details = details;
|
|
21
|
+
}
|
|
22
|
+
/** HTTP/network error */
|
|
23
|
+
static http(message) {
|
|
24
|
+
return new ApiError("Http", `HTTP error: ${message}`);
|
|
25
|
+
}
|
|
26
|
+
/** Resource not found (404) */
|
|
27
|
+
static notFound(message) {
|
|
28
|
+
return new ApiError("NotFound", `Not found: ${message}`, 404);
|
|
29
|
+
}
|
|
30
|
+
/** Invalid request parameters (400) */
|
|
31
|
+
static badRequest(message) {
|
|
32
|
+
return new ApiError("BadRequest", `Bad request: ${message}`, 400);
|
|
33
|
+
}
|
|
34
|
+
/** Permission denied, signature mismatch (403) */
|
|
35
|
+
static forbidden(message) {
|
|
36
|
+
return new ApiError("Forbidden", `Permission denied: ${message}`, 403);
|
|
37
|
+
}
|
|
38
|
+
/** Resource already exists (409) */
|
|
39
|
+
static conflict(message) {
|
|
40
|
+
return new ApiError("Conflict", `Conflict: ${message}`, 409);
|
|
41
|
+
}
|
|
42
|
+
/** Server-side error (500) */
|
|
43
|
+
static serverError(message) {
|
|
44
|
+
return new ApiError("ServerError", `Server error: ${message}`, 500);
|
|
45
|
+
}
|
|
46
|
+
/** JSON deserialization error */
|
|
47
|
+
static deserialize(message) {
|
|
48
|
+
return new ApiError("Deserialize", `Deserialization error: ${message}`);
|
|
49
|
+
}
|
|
50
|
+
/** Invalid parameter provided */
|
|
51
|
+
static invalidParameter(message) {
|
|
52
|
+
return new ApiError("InvalidParameter", `Invalid parameter: ${message}`);
|
|
53
|
+
}
|
|
54
|
+
/** Unexpected HTTP status code */
|
|
55
|
+
static unexpectedStatus(statusCode, message) {
|
|
56
|
+
return new ApiError("UnexpectedStatus", `Unexpected status ${statusCode}: ${message}`, statusCode);
|
|
57
|
+
}
|
|
58
|
+
/** Rate limited (429) */
|
|
59
|
+
static rateLimited(message) {
|
|
60
|
+
return new ApiError("RateLimited", `Rate limited: ${message}`, 429);
|
|
61
|
+
}
|
|
62
|
+
/** Unauthorized - invalid or missing authentication (401) */
|
|
63
|
+
static unauthorized(message) {
|
|
64
|
+
return new ApiError("Unauthorized", `Unauthorized: ${message}`, 401);
|
|
65
|
+
}
|
|
66
|
+
/** Create from HTTP status code */
|
|
67
|
+
static fromStatus(statusCode, message) {
|
|
68
|
+
switch (statusCode) {
|
|
69
|
+
case 401:
|
|
70
|
+
return ApiError.unauthorized(message);
|
|
71
|
+
case 400:
|
|
72
|
+
return ApiError.badRequest(message);
|
|
73
|
+
case 403:
|
|
74
|
+
return ApiError.forbidden(message);
|
|
75
|
+
case 404:
|
|
76
|
+
return ApiError.notFound(message);
|
|
77
|
+
case 409:
|
|
78
|
+
return ApiError.conflict(message);
|
|
79
|
+
case 429:
|
|
80
|
+
return ApiError.rateLimited(message);
|
|
81
|
+
case 500:
|
|
82
|
+
case 502:
|
|
83
|
+
case 503:
|
|
84
|
+
case 504:
|
|
85
|
+
return ApiError.serverError(message);
|
|
86
|
+
default:
|
|
87
|
+
return ApiError.unexpectedStatus(statusCode, message);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.ApiError = ApiError;
|
|
92
|
+
/**
|
|
93
|
+
* Get the error message from an ErrorResponse.
|
|
94
|
+
*/
|
|
95
|
+
function getErrorMessage(response) {
|
|
96
|
+
return response.message || response.error || response.details || "Unknown error";
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/api/error.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAoIH,0CAEC;AApHD;;GAEG;AACH,MAAa,QAAS,SAAQ,KAAK;IACxB,OAAO,CAAkB;IACzB,UAAU,CAAU;IACpB,OAAO,CAAU;IAE1B,YAAY,OAAwB,EAAE,OAAe,EAAE,UAAmB,EAAE,OAAgB;QAC1F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,yBAAyB;IACzB,MAAM,CAAC,IAAI,CAAC,OAAe;QACzB,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,eAAe,OAAO,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,+BAA+B;IAC/B,MAAM,CAAC,QAAQ,CAAC,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n/**\n * API error variants\n */\nexport type ApiErrorVariant =\n | \"Http\"\n | \"NotFound\"\n | \"BadRequest\"\n | \"Forbidden\"\n | \"Conflict\"\n | \"ServerError\"\n | \"Deserialize\"\n | \"InvalidParameter\"\n | \"UnexpectedStatus\"\n | \"RateLimited\"\n | \"Unauthorized\";\n\n/**\n * API-specific error class for the Lightcone REST API client.\n */\nexport class ApiError extends Error {\n readonly variant: ApiErrorVariant;\n readonly statusCode?: number;\n readonly details?: string;\n\n constructor(variant: ApiErrorVariant, message: string, statusCode?: number, details?: string) {\n super(message);\n this.name = \"ApiError\";\n this.variant = variant;\n this.statusCode = statusCode;\n this.details = details;\n }\n\n /** HTTP/network error */\n static http(message: string): ApiError {\n return new ApiError(\"Http\", `HTTP error: ${message}`);\n }\n\n /** Resource not found (404) */\n static notFound(message: string): ApiError {\n return new ApiError(\"NotFound\", `Not found: ${message}`, 404);\n }\n\n /** Invalid request parameters (400) */\n static badRequest(message: string): ApiError {\n return new ApiError(\"BadRequest\", `Bad request: ${message}`, 400);\n }\n\n /** Permission denied, signature mismatch (403) */\n static forbidden(message: string): ApiError {\n return new ApiError(\"Forbidden\", `Permission denied: ${message}`, 403);\n }\n\n /** Resource already exists (409) */\n static conflict(message: string): ApiError {\n return new ApiError(\"Conflict\", `Conflict: ${message}`, 409);\n }\n\n /** Server-side error (500) */\n static serverError(message: string): ApiError {\n return new ApiError(\"ServerError\", `Server error: ${message}`, 500);\n }\n\n /** JSON deserialization error */\n static deserialize(message: string): ApiError {\n return new ApiError(\"Deserialize\", `Deserialization error: ${message}`);\n }\n\n /** Invalid parameter provided */\n static invalidParameter(message: string): ApiError {\n return new ApiError(\"InvalidParameter\", `Invalid parameter: ${message}`);\n }\n\n /** Unexpected HTTP status code */\n static unexpectedStatus(statusCode: number, message: string): ApiError {\n return new ApiError(\"UnexpectedStatus\", `Unexpected status ${statusCode}: ${message}`, statusCode);\n }\n\n /** Rate limited (429) */\n static rateLimited(message: string): ApiError {\n return new ApiError(\"RateLimited\", `Rate limited: ${message}`, 429);\n }\n\n /** Unauthorized - invalid or missing authentication (401) */\n static unauthorized(message: string): ApiError {\n return new ApiError(\"Unauthorized\", `Unauthorized: ${message}`, 401);\n }\n\n /** Create from HTTP status code */\n static fromStatus(statusCode: number, message: string): ApiError {\n switch (statusCode) {\n case 401:\n return ApiError.unauthorized(message);\n case 400:\n return ApiError.badRequest(message);\n case 403:\n return ApiError.forbidden(message);\n case 404:\n return ApiError.notFound(message);\n case 409:\n return ApiError.conflict(message);\n case 429:\n return ApiError.rateLimited(message);\n case 500:\n case 502:\n case 503:\n case 504:\n return ApiError.serverError(message);\n default:\n return ApiError.unexpectedStatus(statusCode, message);\n }\n }\n}\n\n/**\n * Error response format from the API.\n */\nexport interface ErrorResponse {\n /** Error status (usually \"error\") */\n status?: string;\n /** Human-readable error message */\n message?: string;\n /** Alternative error field */\n error?: string;\n /** Additional error details */\n details?: string;\n}\n\n/**\n * Get the error message from an ErrorResponse.\n */\nexport function getErrorMessage(response: ErrorResponse): string {\n return response.message || response.error || response.details || \"Unknown error\";\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REST API client module for Lightcone.
|
|
3
|
+
*
|
|
4
|
+
* This module provides HTTP client functionality for interacting with
|
|
5
|
+
* the Lightcone REST API for orderbook data, market info, and more.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { api } from "@lightcone/sdk";
|
|
10
|
+
*
|
|
11
|
+
* const client = new api.LightconeApiClient();
|
|
12
|
+
* const markets = await client.getMarkets();
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @module api
|
|
16
|
+
*/
|
|
17
|
+
export { LightconeApiClient, DEFAULT_API_URL, DEFAULT_RETRY_CONFIG, } from "./client";
|
|
18
|
+
export type { LightconeApiClientConfig, RetryConfig } from "./client";
|
|
19
|
+
export { ApiError } from "./error";
|
|
20
|
+
export type { ApiErrorVariant, ErrorResponse } from "./error";
|
|
21
|
+
export { validatePubkey, validateSignature, validateLimit, MAX_PAGINATION_LIMIT, DEFAULT_TIMEOUT_MS, } from "./validation";
|
|
22
|
+
export * from "./types";
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGtE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG9D,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* REST API client module for Lightcone.
|
|
4
|
+
*
|
|
5
|
+
* This module provides HTTP client functionality for interacting with
|
|
6
|
+
* the Lightcone REST API for orderbook data, market info, and more.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { api } from "@lightcone/sdk";
|
|
11
|
+
*
|
|
12
|
+
* const client = new api.LightconeApiClient();
|
|
13
|
+
* const markets = await client.getMarkets();
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @module api
|
|
17
|
+
*/
|
|
18
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
22
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(o, k2, desc);
|
|
25
|
+
}) : (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
o[k2] = m[k];
|
|
28
|
+
}));
|
|
29
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
30
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.DEFAULT_TIMEOUT_MS = exports.MAX_PAGINATION_LIMIT = exports.validateLimit = exports.validateSignature = exports.validatePubkey = exports.ApiError = exports.DEFAULT_RETRY_CONFIG = exports.DEFAULT_API_URL = exports.LightconeApiClient = void 0;
|
|
34
|
+
// Client
|
|
35
|
+
var client_1 = require("./client");
|
|
36
|
+
Object.defineProperty(exports, "LightconeApiClient", { enumerable: true, get: function () { return client_1.LightconeApiClient; } });
|
|
37
|
+
Object.defineProperty(exports, "DEFAULT_API_URL", { enumerable: true, get: function () { return client_1.DEFAULT_API_URL; } });
|
|
38
|
+
Object.defineProperty(exports, "DEFAULT_RETRY_CONFIG", { enumerable: true, get: function () { return client_1.DEFAULT_RETRY_CONFIG; } });
|
|
39
|
+
// Error types
|
|
40
|
+
var error_1 = require("./error");
|
|
41
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return error_1.ApiError; } });
|
|
42
|
+
// Validation utilities
|
|
43
|
+
var validation_1 = require("./validation");
|
|
44
|
+
Object.defineProperty(exports, "validatePubkey", { enumerable: true, get: function () { return validation_1.validatePubkey; } });
|
|
45
|
+
Object.defineProperty(exports, "validateSignature", { enumerable: true, get: function () { return validation_1.validateSignature; } });
|
|
46
|
+
Object.defineProperty(exports, "validateLimit", { enumerable: true, get: function () { return validation_1.validateLimit; } });
|
|
47
|
+
Object.defineProperty(exports, "MAX_PAGINATION_LIMIT", { enumerable: true, get: function () { return validation_1.MAX_PAGINATION_LIMIT; } });
|
|
48
|
+
Object.defineProperty(exports, "DEFAULT_TIMEOUT_MS", { enumerable: true, get: function () { return validation_1.DEFAULT_TIMEOUT_MS; } });
|
|
49
|
+
// All types
|
|
50
|
+
__exportStar(require("./types"), exports);
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;AAEH,SAAS;AACT,mCAIkB;AAHhB,4GAAA,kBAAkB,OAAA;AAClB,yGAAA,eAAe,OAAA;AACf,8GAAA,oBAAoB,OAAA;AAItB,cAAc;AACd,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA;AAGjB,uBAAuB;AACvB,2CAMsB;AALpB,4GAAA,cAAc,OAAA;AACd,+GAAA,iBAAiB,OAAA;AACjB,2GAAA,aAAa,OAAA;AACb,kHAAA,oBAAoB,OAAA;AACpB,gHAAA,kBAAkB,OAAA;AAGpB,YAAY;AACZ,0CAAwB","sourcesContent":["/**\n * REST API client module for Lightcone.\n *\n * This module provides HTTP client functionality for interacting with\n * the Lightcone REST API for orderbook data, market info, and more.\n *\n * @example\n * ```typescript\n * import { api } from \"@lightcone/sdk\";\n *\n * const client = new api.LightconeApiClient();\n * const markets = await client.getMarkets();\n * ```\n *\n * @module api\n */\n\n// Client\nexport {\n LightconeApiClient,\n DEFAULT_API_URL,\n DEFAULT_RETRY_CONFIG,\n} from \"./client\";\nexport type { LightconeApiClientConfig, RetryConfig } from \"./client\";\n\n// Error types\nexport { ApiError } from \"./error\";\nexport type { ApiErrorVariant, ErrorResponse } from \"./error\";\n\n// Validation utilities\nexport {\n validatePubkey,\n validateSignature,\n validateLimit,\n MAX_PAGINATION_LIMIT,\n DEFAULT_TIMEOUT_MS,\n} from \"./validation\";\n\n// All types\nexport * from \"./types\";\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin-related types for the Lightcone REST API.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Response for GET /api/admin/test.
|
|
6
|
+
*/
|
|
7
|
+
export interface AdminResponse {
|
|
8
|
+
/** Status (usually "success") */
|
|
9
|
+
status: string;
|
|
10
|
+
/** Human-readable message */
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Request for POST /api/admin/create-orderbook.
|
|
15
|
+
*/
|
|
16
|
+
export interface CreateOrderbookRequest {
|
|
17
|
+
/** Market address (Base58) */
|
|
18
|
+
market_pubkey: string;
|
|
19
|
+
/** Base conditional token (Base58) */
|
|
20
|
+
base_token: string;
|
|
21
|
+
/** Quote conditional token (Base58) */
|
|
22
|
+
quote_token: string;
|
|
23
|
+
/** Price granularity (default: 1000) */
|
|
24
|
+
tick_size?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a new CreateOrderbookRequest with required fields.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createOrderbookRequest(market_pubkey: string, base_token: string, quote_token: string): CreateOrderbookRequest;
|
|
30
|
+
/**
|
|
31
|
+
* Response for POST /api/admin/create-orderbook.
|
|
32
|
+
*/
|
|
33
|
+
export interface CreateOrderbookResponse {
|
|
34
|
+
/** Status (usually "success") */
|
|
35
|
+
status: string;
|
|
36
|
+
/** Created orderbook ID */
|
|
37
|
+
orderbook_id: string;
|
|
38
|
+
/** Market pubkey */
|
|
39
|
+
market_pubkey: string;
|
|
40
|
+
/** Base token address */
|
|
41
|
+
base_token: string;
|
|
42
|
+
/** Quote token address */
|
|
43
|
+
quote_token: string;
|
|
44
|
+
/** Tick size */
|
|
45
|
+
tick_size: number;
|
|
46
|
+
/** Human-readable message */
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/api/types/admin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,8BAA8B;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,sBAAsB,CAExB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Admin-related types for the Lightcone REST API.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createOrderbookRequest = createOrderbookRequest;
|
|
7
|
+
/**
|
|
8
|
+
* Create a new CreateOrderbookRequest with required fields.
|
|
9
|
+
*/
|
|
10
|
+
function createOrderbookRequest(market_pubkey, base_token, quote_token) {
|
|
11
|
+
return { market_pubkey, base_token, quote_token };
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../src/api/types/admin.ts"],"names":[],"mappings":";AAAA;;GAEG;;AA6BH,wDAMC;AATD;;GAEG;AACH,SAAgB,sBAAsB,CACpC,aAAqB,EACrB,UAAkB,EAClB,WAAmB;IAEnB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AACpD,CAAC","sourcesContent":["/**\n * Admin-related types for the Lightcone REST API.\n */\n\n/**\n * Response for GET /api/admin/test.\n */\nexport interface AdminResponse {\n /** Status (usually \"success\") */\n status: string;\n /** Human-readable message */\n message: string;\n}\n\n/**\n * Request for POST /api/admin/create-orderbook.\n */\nexport interface CreateOrderbookRequest {\n /** Market address (Base58) */\n market_pubkey: string;\n /** Base conditional token (Base58) */\n base_token: string;\n /** Quote conditional token (Base58) */\n quote_token: string;\n /** Price granularity (default: 1000) */\n tick_size?: number;\n}\n\n/**\n * Create a new CreateOrderbookRequest with required fields.\n */\nexport function createOrderbookRequest(\n market_pubkey: string,\n base_token: string,\n quote_token: string\n): CreateOrderbookRequest {\n return { market_pubkey, base_token, quote_token };\n}\n\n/**\n * Response for POST /api/admin/create-orderbook.\n */\nexport interface CreateOrderbookResponse {\n /** Status (usually \"success\") */\n status: string;\n /** Created orderbook ID */\n orderbook_id: string;\n /** Market pubkey */\n market_pubkey: string;\n /** Base token address */\n base_token: string;\n /** Quote token address */\n quote_token: string;\n /** Tick size */\n tick_size: number;\n /** Human-readable message */\n message: string;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export all API types.
|
|
3
|
+
*/
|
|
4
|
+
export type { ApiMarketStatus, Outcome, OrderbookSummary, ConditionalToken, DepositAsset, Market, MarketsResponse, MarketInfoResponse, DepositAssetsResponse, } from "./market";
|
|
5
|
+
export type { ApiOrderSide, OrderStatusValue, Fill, SubmitOrderRequest, OrderResponse, CancelOrderRequest, CancelResponse, CancelAllOrdersRequest, CancelAllResponse, UserOrder, GetUserOrdersRequest, UserOrderOutcomeBalance, UserBalance, UserOrdersResponse, } from "./order";
|
|
6
|
+
export type { PriceLevel, OrderbookResponse } from "./orderbook";
|
|
7
|
+
export type { OutcomeBalance, Position, PositionsResponse, MarketPositionsResponse, } from "./position";
|
|
8
|
+
export type { PricePoint, PriceHistoryParams, PriceHistoryResponse, } from "./price_history";
|
|
9
|
+
export { createPriceHistoryParams } from "./price_history";
|
|
10
|
+
export type { TradeSide, Trade, TradesParams, TradesResponse } from "./trade";
|
|
11
|
+
export { createTradesParams } from "./trade";
|
|
12
|
+
export type { AdminResponse, CreateOrderbookRequest, CreateOrderbookResponse, } from "./admin";
|
|
13
|
+
export { createOrderbookRequest } from "./admin";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,IAAI,EACJ,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGjE,YAAY,EACV,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Re-export all API types.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createOrderbookRequest = exports.createTradesParams = exports.createPriceHistoryParams = void 0;
|
|
7
|
+
var price_history_1 = require("./price_history");
|
|
8
|
+
Object.defineProperty(exports, "createPriceHistoryParams", { enumerable: true, get: function () { return price_history_1.createPriceHistoryParams; } });
|
|
9
|
+
var trade_1 = require("./trade");
|
|
10
|
+
Object.defineProperty(exports, "createTradesParams", { enumerable: true, get: function () { return trade_1.createTradesParams; } });
|
|
11
|
+
var admin_1 = require("./admin");
|
|
12
|
+
Object.defineProperty(exports, "createOrderbookRequest", { enumerable: true, get: function () { return admin_1.createOrderbookRequest; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/types/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAkDH,iDAA2D;AAAlD,yHAAA,wBAAwB,OAAA;AAIjC,iCAA6C;AAApC,2GAAA,kBAAkB,OAAA;AAQ3B,iCAAiD;AAAxC,+GAAA,sBAAsB,OAAA","sourcesContent":["/**\n * Re-export all API types.\n */\n\n// Market types\nexport type {\n ApiMarketStatus,\n Outcome,\n OrderbookSummary,\n ConditionalToken,\n DepositAsset,\n Market,\n MarketsResponse,\n MarketInfoResponse,\n DepositAssetsResponse,\n} from \"./market\";\n\n// Order types\nexport type {\n ApiOrderSide,\n OrderStatusValue,\n Fill,\n SubmitOrderRequest,\n OrderResponse,\n CancelOrderRequest,\n CancelResponse,\n CancelAllOrdersRequest,\n CancelAllResponse,\n UserOrder,\n GetUserOrdersRequest,\n UserOrderOutcomeBalance,\n UserBalance,\n UserOrdersResponse,\n} from \"./order\";\n\n// Orderbook types\nexport type { PriceLevel, OrderbookResponse } from \"./orderbook\";\n\n// Position types\nexport type {\n OutcomeBalance,\n Position,\n PositionsResponse,\n MarketPositionsResponse,\n} from \"./position\";\n\n// Price history types\nexport type {\n PricePoint,\n PriceHistoryParams,\n PriceHistoryResponse,\n} from \"./price_history\";\nexport { createPriceHistoryParams } from \"./price_history\";\n\n// Trade types\nexport type { TradeSide, Trade, TradesParams, TradesResponse } from \"./trade\";\nexport { createTradesParams } from \"./trade\";\n\n// Admin types\nexport type {\n AdminResponse,\n CreateOrderbookRequest,\n CreateOrderbookResponse,\n} from \"./admin\";\nexport { createOrderbookRequest } from \"./admin\";\n"]}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Market-related types for the Lightcone REST API.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Market status enum matching the API specification.
|
|
6
|
+
*/
|
|
7
|
+
export type ApiMarketStatus = "Pending" | "Active" | "Settled";
|
|
8
|
+
/**
|
|
9
|
+
* Outcome information for a market.
|
|
10
|
+
*/
|
|
11
|
+
export interface Outcome {
|
|
12
|
+
/** Outcome index (0-based) */
|
|
13
|
+
index: number;
|
|
14
|
+
/** Outcome name */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Optional thumbnail URL */
|
|
17
|
+
thumbnail_url?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Orderbook summary embedded in market response.
|
|
21
|
+
*/
|
|
22
|
+
export interface OrderbookSummary {
|
|
23
|
+
/** Orderbook identifier */
|
|
24
|
+
orderbook_id: string;
|
|
25
|
+
/** Market pubkey */
|
|
26
|
+
market_pubkey: string;
|
|
27
|
+
/** Base token address */
|
|
28
|
+
base_token: string;
|
|
29
|
+
/** Quote token address */
|
|
30
|
+
quote_token: string;
|
|
31
|
+
/** Tick size for price granularity */
|
|
32
|
+
tick_size: number;
|
|
33
|
+
/** Creation timestamp */
|
|
34
|
+
created_at: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Conditional token information.
|
|
38
|
+
*/
|
|
39
|
+
export interface ConditionalToken {
|
|
40
|
+
/** Database ID */
|
|
41
|
+
id: number;
|
|
42
|
+
/** Outcome index this token represents */
|
|
43
|
+
outcome_index: number;
|
|
44
|
+
/** Token mint address */
|
|
45
|
+
token_address: string;
|
|
46
|
+
/** Token name */
|
|
47
|
+
name: string;
|
|
48
|
+
/** Token symbol */
|
|
49
|
+
symbol: string;
|
|
50
|
+
/** Token metadata URI */
|
|
51
|
+
uri?: string;
|
|
52
|
+
/** Display name for UI */
|
|
53
|
+
display_name: string;
|
|
54
|
+
/** Outcome name */
|
|
55
|
+
outcome: string;
|
|
56
|
+
/** Associated deposit symbol */
|
|
57
|
+
deposit_symbol: string;
|
|
58
|
+
/** Short name for display */
|
|
59
|
+
short_name: string;
|
|
60
|
+
/** Token description */
|
|
61
|
+
description?: string;
|
|
62
|
+
/** Icon URL */
|
|
63
|
+
icon_url?: string;
|
|
64
|
+
/** Metadata URI */
|
|
65
|
+
metadata_uri?: string;
|
|
66
|
+
/** Token decimals */
|
|
67
|
+
decimals: number;
|
|
68
|
+
/** Creation timestamp */
|
|
69
|
+
created_at: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Deposit asset information.
|
|
73
|
+
*/
|
|
74
|
+
export interface DepositAsset {
|
|
75
|
+
/** Display name for the asset */
|
|
76
|
+
display_name: string;
|
|
77
|
+
/** Token symbol */
|
|
78
|
+
token_symbol: string;
|
|
79
|
+
/** Short symbol */
|
|
80
|
+
symbol: string;
|
|
81
|
+
/** Deposit asset mint address */
|
|
82
|
+
deposit_asset: string;
|
|
83
|
+
/** Database ID */
|
|
84
|
+
id: number;
|
|
85
|
+
/** Associated market pubkey */
|
|
86
|
+
market_pubkey: string;
|
|
87
|
+
/** Vault address */
|
|
88
|
+
vault: string;
|
|
89
|
+
/** Number of outcomes */
|
|
90
|
+
num_outcomes: number;
|
|
91
|
+
/** Asset description */
|
|
92
|
+
description?: string;
|
|
93
|
+
/** Icon URL */
|
|
94
|
+
icon_url?: string;
|
|
95
|
+
/** Metadata URI */
|
|
96
|
+
metadata_uri?: string;
|
|
97
|
+
/** Token decimals */
|
|
98
|
+
decimals: number;
|
|
99
|
+
/** Conditional tokens for each outcome */
|
|
100
|
+
conditional_tokens: ConditionalToken[];
|
|
101
|
+
/** Creation timestamp */
|
|
102
|
+
created_at: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Market information.
|
|
106
|
+
*/
|
|
107
|
+
export interface Market {
|
|
108
|
+
/** Market name */
|
|
109
|
+
market_name: string;
|
|
110
|
+
/** URL-friendly slug */
|
|
111
|
+
slug: string;
|
|
112
|
+
/** Market description */
|
|
113
|
+
description: string;
|
|
114
|
+
/** Market definition/rules */
|
|
115
|
+
definition: string;
|
|
116
|
+
/** Possible outcomes */
|
|
117
|
+
outcomes: Outcome[];
|
|
118
|
+
/** Banner image URL */
|
|
119
|
+
banner_image_url?: string;
|
|
120
|
+
/** Thumbnail URL */
|
|
121
|
+
thumbnail_url?: string;
|
|
122
|
+
/** Market category */
|
|
123
|
+
category?: string;
|
|
124
|
+
/** Tags for filtering */
|
|
125
|
+
tags: string[];
|
|
126
|
+
/** Featured rank (0 = not featured) */
|
|
127
|
+
featured_rank: number;
|
|
128
|
+
/** Market PDA address */
|
|
129
|
+
market_pubkey: string;
|
|
130
|
+
/** Market ID */
|
|
131
|
+
market_id: number;
|
|
132
|
+
/** Oracle address */
|
|
133
|
+
oracle: string;
|
|
134
|
+
/** Question ID */
|
|
135
|
+
question_id: string;
|
|
136
|
+
/** Condition ID */
|
|
137
|
+
condition_id: string;
|
|
138
|
+
/** Current market status */
|
|
139
|
+
market_status: ApiMarketStatus;
|
|
140
|
+
/** Winning outcome index (if settled) */
|
|
141
|
+
winning_outcome: number;
|
|
142
|
+
/** Whether market has a winning outcome */
|
|
143
|
+
has_winning_outcome: boolean;
|
|
144
|
+
/** Creation timestamp */
|
|
145
|
+
created_at: string;
|
|
146
|
+
/** Activation timestamp */
|
|
147
|
+
activated_at?: string;
|
|
148
|
+
/** Settlement timestamp */
|
|
149
|
+
settled_at?: string;
|
|
150
|
+
/** Deposit assets for this market */
|
|
151
|
+
deposit_assets: DepositAsset[];
|
|
152
|
+
/** Orderbooks for this market */
|
|
153
|
+
orderbooks: OrderbookSummary[];
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Response for GET /api/markets.
|
|
157
|
+
*/
|
|
158
|
+
export interface MarketsResponse {
|
|
159
|
+
/** List of markets */
|
|
160
|
+
markets: Market[];
|
|
161
|
+
/** Total count */
|
|
162
|
+
total: number;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Response for GET /api/markets/{market_pubkey}.
|
|
166
|
+
*/
|
|
167
|
+
export interface MarketInfoResponse {
|
|
168
|
+
/** Market details */
|
|
169
|
+
market: Market;
|
|
170
|
+
/** Deposit assets */
|
|
171
|
+
deposit_assets: DepositAsset[];
|
|
172
|
+
/** Count of deposit assets */
|
|
173
|
+
deposit_asset_count: number;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Response for GET /api/markets/{market_pubkey}/deposit-assets.
|
|
177
|
+
*/
|
|
178
|
+
export interface DepositAssetsResponse {
|
|
179
|
+
/** Market pubkey */
|
|
180
|
+
market_pubkey: string;
|
|
181
|
+
/** Deposit assets */
|
|
182
|
+
deposit_assets: DepositAsset[];
|
|
183
|
+
/** Total count */
|
|
184
|
+
total: number;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=market.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../../src/api/types/market.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0B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ACf,qBAAqB;IACrB,cAAc,EAAE,YAAY,EAAE,CAAC;IAC/B,8BAA8B;IAC9B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,cAAc,EAAE,YAAY,EAAE,CAAC;IAC/B,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market.js","sourceRoot":"","sources":["../../../src/api/types/market.ts"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Market-related types for the Lightcone REST API.\n */\n\n/**\n * Market status enum matching the API specification.\n */\nexport type ApiMarketStatus = \"Pending\" | \"Active\" | \"Settled\";\n\n/**\n * Outcome information for a market.\n */\nexport interface Outcome {\n /** Outcome index (0-based) */\n index: number;\n /** Outcome name */\n name: string;\n /** Optional thumbnail URL */\n thumbnail_url?: string;\n}\n\n/**\n * Orderbook summary embedded in market response.\n */\nexport interface OrderbookSummary {\n /** Orderbook identifier */\n orderbook_id: string;\n /** Market pubkey */\n market_pubkey: string;\n /** Base token address */\n base_token: string;\n /** Quote token address */\n quote_token: string;\n /** Tick size for price granularity */\n tick_size: number;\n /** Creation timestamp */\n created_at: string;\n}\n\n/**\n * Conditional token information.\n */\nexport interface ConditionalToken {\n /** Database ID */\n id: number;\n /** Outcome index this token represents */\n outcome_index: number;\n /** Token mint address */\n token_address: string;\n /** Token name */\n name: string;\n /** Token symbol */\n symbol: string;\n /** Token metadata URI */\n uri?: string;\n /** Display name for UI */\n display_name: string;\n /** Outcome name */\n outcome: string;\n /** Associated deposit symbol */\n deposit_symbol: string;\n /** Short name for display */\n short_name: string;\n /** Token description */\n description?: string;\n /** Icon URL */\n icon_url?: string;\n /** Metadata URI */\n metadata_uri?: string;\n /** Token decimals */\n decimals: number;\n /** Creation timestamp */\n created_at: string;\n}\n\n/**\n * Deposit asset information.\n */\nexport interface DepositAsset {\n /** Display name for the asset */\n display_name: string;\n /** Token symbol */\n token_symbol: string;\n /** Short symbol */\n symbol: string;\n /** Deposit asset mint address */\n deposit_asset: string;\n /** Database ID */\n id: number;\n /** Associated market pubkey */\n market_pubkey: string;\n /** Vault address */\n vault: string;\n /** Number of outcomes */\n num_outcomes: number;\n /** Asset description */\n description?: string;\n /** Icon URL */\n icon_url?: string;\n /** Metadata URI */\n metadata_uri?: string;\n /** Token decimals */\n decimals: number;\n /** Conditional tokens for each outcome */\n conditional_tokens: ConditionalToken[];\n /** Creation timestamp */\n created_at: string;\n}\n\n/**\n * Market information.\n */\nexport interface Market {\n /** Market name */\n market_name: string;\n /** URL-friendly slug */\n slug: string;\n /** Market description */\n description: string;\n /** Market definition/rules */\n definition: string;\n /** Possible outcomes */\n outcomes: Outcome[];\n /** Banner image URL */\n banner_image_url?: string;\n /** Thumbnail URL */\n thumbnail_url?: string;\n /** Market category */\n category?: string;\n /** Tags for filtering */\n tags: string[];\n /** Featured rank (0 = not featured) */\n featured_rank: number;\n /** Market PDA address */\n market_pubkey: string;\n /** Market ID */\n market_id: number;\n /** Oracle address */\n oracle: string;\n /** Question ID */\n question_id: string;\n /** Condition ID */\n condition_id: string;\n /** Current market status */\n market_status: ApiMarketStatus;\n /** Winning outcome index (if settled) */\n winning_outcome: number;\n /** Whether market has a winning outcome */\n has_winning_outcome: boolean;\n /** Creation timestamp */\n created_at: string;\n /** Activation timestamp */\n activated_at?: string;\n /** Settlement timestamp */\n settled_at?: string;\n /** Deposit assets for this market */\n deposit_assets: DepositAsset[];\n /** Orderbooks for this market */\n orderbooks: OrderbookSummary[];\n}\n\n/**\n * Response for GET /api/markets.\n */\nexport interface MarketsResponse {\n /** List of markets */\n markets: Market[];\n /** Total count */\n total: number;\n}\n\n/**\n * Response for GET /api/markets/{market_pubkey}.\n */\nexport interface MarketInfoResponse {\n /** Market details */\n market: Market;\n /** Deposit assets */\n deposit_assets: DepositAsset[];\n /** Count of deposit assets */\n deposit_asset_count: number;\n}\n\n/**\n * Response for GET /api/markets/{market_pubkey}/deposit-assets.\n */\nexport interface DepositAssetsResponse {\n /** Market pubkey */\n market_pubkey: string;\n /** Deposit assets */\n deposit_assets: DepositAsset[];\n /** Total count */\n total: number;\n}\n"]}
|