@signals-protocol/v1-sdk 1.6.0 → 1.7.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/dist/index.d.ts +2 -1
- package/dist/index.js +6 -2
- package/dist/oracle.d.ts +11 -0
- package/dist/oracle.js +24 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.js +6 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
export { CLMSRSDK } from "./clmsr-sdk";
|
|
7
7
|
export { CLMSRSDK as SignalsSDK } from "./clmsr-sdk";
|
|
8
8
|
export { WADAmount, USDCAmount, Quantity, Tick, MarketDistributionRaw, MarketRaw, Market, MarketDistribution, Position, mapMarket, mapDistribution, OpenCostResult, IncreaseCostResult, DecreaseProceedsResult, CloseProceedsResult, ClaimResult, QuantityFromCostResult, QuantityFromProceedsResult, PositionValueResult, FeeInfo, ValidationError, CalculationError, } from "./types";
|
|
9
|
+
export { MarketOracleConfig, BTC_ORACLE_CONFIG, encodeFeedId } from "./oracle";
|
|
9
10
|
export * as MathUtils from "./utils/math";
|
|
10
11
|
export { toWAD, toMicroUSDC } from "./clmsr-sdk";
|
|
11
12
|
export { createCLMSRSDK, createSignalsSDK } from "./clmsr-sdk";
|
|
12
13
|
export * from "./share";
|
|
13
|
-
export declare const VERSION = "1.
|
|
14
|
+
export declare const VERSION = "1.7.0";
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
41
41
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.VERSION = exports.createSignalsSDK = exports.createCLMSRSDK = exports.toMicroUSDC = exports.toWAD = exports.MathUtils = exports.CalculationError = exports.ValidationError = exports.mapDistribution = exports.mapMarket = exports.SignalsSDK = exports.CLMSRSDK = void 0;
|
|
44
|
+
exports.VERSION = exports.createSignalsSDK = exports.createCLMSRSDK = exports.toMicroUSDC = exports.toWAD = exports.MathUtils = exports.encodeFeedId = exports.BTC_ORACLE_CONFIG = exports.CalculationError = exports.ValidationError = exports.mapDistribution = exports.mapMarket = exports.SignalsSDK = exports.CLMSRSDK = void 0;
|
|
45
45
|
// Export main SDK class
|
|
46
46
|
var clmsr_sdk_1 = require("./clmsr-sdk");
|
|
47
47
|
Object.defineProperty(exports, "CLMSRSDK", { enumerable: true, get: function () { return clmsr_sdk_1.CLMSRSDK; } });
|
|
@@ -55,6 +55,10 @@ Object.defineProperty(exports, "mapDistribution", { enumerable: true, get: funct
|
|
|
55
55
|
// Errors
|
|
56
56
|
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return types_1.ValidationError; } });
|
|
57
57
|
Object.defineProperty(exports, "CalculationError", { enumerable: true, get: function () { return types_1.CalculationError; } });
|
|
58
|
+
// Export oracle config helpers
|
|
59
|
+
var oracle_1 = require("./oracle");
|
|
60
|
+
Object.defineProperty(exports, "BTC_ORACLE_CONFIG", { enumerable: true, get: function () { return oracle_1.BTC_ORACLE_CONFIG; } });
|
|
61
|
+
Object.defineProperty(exports, "encodeFeedId", { enumerable: true, get: function () { return oracle_1.encodeFeedId; } });
|
|
58
62
|
// Export utility functions
|
|
59
63
|
exports.MathUtils = __importStar(require("./utils/math"));
|
|
60
64
|
// Convenience functions
|
|
@@ -67,4 +71,4 @@ Object.defineProperty(exports, "createSignalsSDK", { enumerable: true, get: func
|
|
|
67
71
|
// Share image VNode templates
|
|
68
72
|
__exportStar(require("./share"), exports);
|
|
69
73
|
// Version (keep in sync with package.json)
|
|
70
|
-
exports.VERSION = "1.
|
|
74
|
+
exports.VERSION = "1.7.0";
|
package/dist/oracle.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface MarketOracleConfig {
|
|
2
|
+
feedId: `0x${string}`;
|
|
3
|
+
feedDecimals: number;
|
|
4
|
+
tickScale: bigint;
|
|
5
|
+
}
|
|
6
|
+
export declare function encodeFeedId(symbol: string): `0x${string}`;
|
|
7
|
+
export declare const BTC_ORACLE_CONFIG: {
|
|
8
|
+
readonly feedId: `0x${string}`;
|
|
9
|
+
readonly feedDecimals: 8;
|
|
10
|
+
readonly tickScale: 1000000n;
|
|
11
|
+
};
|
package/dist/oracle.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BTC_ORACLE_CONFIG = void 0;
|
|
4
|
+
exports.encodeFeedId = encodeFeedId;
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const BYTES32_SIZE = 32;
|
|
7
|
+
const HEX_BYTE_LENGTH = 2;
|
|
8
|
+
const encoder = new TextEncoder();
|
|
9
|
+
function encodeFeedId(symbol) {
|
|
10
|
+
if (symbol.length === 0) {
|
|
11
|
+
throw new types_1.ValidationError("symbol must be non-empty");
|
|
12
|
+
}
|
|
13
|
+
const bytes = encoder.encode(symbol);
|
|
14
|
+
if (bytes.length > BYTES32_SIZE) {
|
|
15
|
+
throw new types_1.ValidationError("symbol exceeds 32 bytes");
|
|
16
|
+
}
|
|
17
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(HEX_BYTE_LENGTH, "0")).join("");
|
|
18
|
+
return `0x${hex.padEnd(BYTES32_SIZE * HEX_BYTE_LENGTH, "0")}`;
|
|
19
|
+
}
|
|
20
|
+
exports.BTC_ORACLE_CONFIG = {
|
|
21
|
+
feedId: encodeFeedId("BTC"),
|
|
22
|
+
feedDecimals: 8,
|
|
23
|
+
tickScale: 1000000n,
|
|
24
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -29,6 +29,10 @@ export interface MarketRaw {
|
|
|
29
29
|
isSettled?: boolean;
|
|
30
30
|
settlementValue?: string;
|
|
31
31
|
settlementTick?: number;
|
|
32
|
+
feedId?: string;
|
|
33
|
+
feedDecimals?: number;
|
|
34
|
+
tickScale?: string;
|
|
35
|
+
assetSymbol?: string;
|
|
32
36
|
}
|
|
33
37
|
/** Market data for SDK calculations (숫자 객체만) */
|
|
34
38
|
export interface Market {
|
|
@@ -41,6 +45,10 @@ export interface Market {
|
|
|
41
45
|
isSettled?: boolean;
|
|
42
46
|
settlementValue?: USDCAmount;
|
|
43
47
|
settlementTick?: Tick;
|
|
48
|
+
feedId?: string;
|
|
49
|
+
feedDecimals?: number;
|
|
50
|
+
tickScale?: bigint;
|
|
51
|
+
assetSymbol?: string;
|
|
44
52
|
}
|
|
45
53
|
/** Market distribution data for SDK calculations (WAD 기반) */
|
|
46
54
|
export interface MarketDistribution {
|
package/dist/types.js
CHANGED
|
@@ -43,6 +43,12 @@ function mapMarket(raw) {
|
|
|
43
43
|
...(raw.settlementTick !== undefined && {
|
|
44
44
|
settlementTick: raw.settlementTick,
|
|
45
45
|
}),
|
|
46
|
+
...(raw.feedId !== undefined && { feedId: raw.feedId }),
|
|
47
|
+
...(raw.feedDecimals !== undefined && {
|
|
48
|
+
feedDecimals: raw.feedDecimals,
|
|
49
|
+
}),
|
|
50
|
+
...(raw.tickScale !== undefined && { tickScale: BigInt(raw.tickScale) }),
|
|
51
|
+
...(raw.assetSymbol !== undefined && { assetSymbol: raw.assetSymbol }),
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
/**
|