@polyester/sdk 0.18.0 → 0.19.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/CHANGELOG.md +10 -0
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/market-overview/market-overview.d.ts +1 -0
- package/dist/services/market-overview/market-overview.d.ts.map +1 -1
- package/dist/services/market-overview/market-overview.js +24 -6
- package/dist/services/market-overview/market-overview.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +6 -6
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +4 -4
- package/dist/services/trades/trades.d.ts +3 -4
- package/dist/services/trades/trades.d.ts.map +1 -1
- package/dist/services/trades/trades.js +1 -1
- package/dist/services/trades/trades.js.map +1 -1
- package/dist/services/trades/trades.schemas.d.ts +41 -7
- package/dist/services/trades/trades.schemas.d.ts.map +1 -1
- package/dist/services/trades/trades.schemas.js +20 -10
- package/dist/services/trades/trades.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +18 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @polyester/sdk
|
|
2
2
|
|
|
3
|
+
## 0.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fix(trades)!: `trades.list()` input is now a discriminated union. Passing `afterMatchId` requires a positive `symbolId`, matching the backend's `after_match_requires_symbol` rule; violating it is a compile error and an SDK `ValidationError` instead of a 400. ([#110](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/110))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- fix(market-overview): skip rows whose symbolId the catalog cannot resolve instead of failing the whole `list()` result or `subscribe()` snapshot; `subscribe()` now accepts an optional `symbolIds` filter forwarded to its snapshot request. ([#110](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/110))
|
|
12
|
+
|
|
3
13
|
## 0.18.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -14,7 +14,7 @@ type TimestampInit = {
|
|
|
14
14
|
declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
15
15
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
16
16
|
readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1s" | "1m" | "5m" | "1h", HeatmapInterval>]>;
|
|
17
|
-
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 1000 | 500 |
|
|
17
|
+
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 1000 | 500 | 100 | 50, HeatmapDepth>]>;
|
|
18
18
|
readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
|
|
19
19
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
|
|
20
20
|
readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
|
|
@@ -227,7 +227,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
|
|
|
227
227
|
declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
228
228
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
229
229
|
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
|
|
230
|
-
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
230
|
+
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50>]>;
|
|
231
231
|
readonly chain: v.OptionalSchema<v.ObjectSchema<{
|
|
232
232
|
readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
|
|
233
233
|
readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
@@ -287,7 +287,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
287
287
|
}, undefined>, v.TransformAction<{
|
|
288
288
|
symbolId: number;
|
|
289
289
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
290
|
-
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
290
|
+
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50;
|
|
291
291
|
chain?: {
|
|
292
292
|
baseKeyframe?: {
|
|
293
293
|
tsSec: number;
|
|
@@ -347,7 +347,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
347
347
|
}, {
|
|
348
348
|
symbolId: number;
|
|
349
349
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
350
|
-
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
350
|
+
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50;
|
|
351
351
|
chain: {
|
|
352
352
|
baseKeyframe: {
|
|
353
353
|
tsSec: number;
|
|
@@ -6,6 +6,7 @@ import { SdkScales } from "../../shared/decimal-surface.js";
|
|
|
6
6
|
import { ListMarketOverviewInput, MarketOverview, SparklineIntervalName } from "./market-overview.schemas.js";
|
|
7
7
|
//#region src/services/market-overview/market-overview.d.ts
|
|
8
8
|
interface SubscribeMarketOverviewInput extends BaseSubscribeInput<MarketOverview[]> {
|
|
9
|
+
symbolIds?: number[];
|
|
9
10
|
includeSparklines?: boolean;
|
|
10
11
|
sparklineIntervals?: SparklineIntervalName[];
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market-overview.d.ts","names":[],"sources":["../../../src/services/market-overview/market-overview.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"market-overview.d.ts","names":[],"sources":["../../../src/services/market-overview/market-overview.ts"],"mappings":";;;;;;;UAsBU,qCAAqC,mBAAmB;EAC9D;EACA;EACA,qBAAqB;;;;;cAMZ;;EAMG,YAAA,YAAY,qBAAqB,UAAU,mBAAmB,QAAQ;;;;EAU5E,KACF,QAAO,yBACP,UAAU,0BACX;IAAU,SAAS;IAAkB;;;;;EA8CxC,UAAU,OAAO"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { parse } from "../../shared/validation.js";
|
|
2
2
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
+
import { CatalogLookupError } from "../../catalogs/types.js";
|
|
4
|
+
import { isDev } from "../../utils/is-dev.js";
|
|
3
5
|
import { MarketOverviewBatchSchema, MarketOverviewService as MarketOverviewService$1 } from "../../gen/marketoverview/v1/marketoverview_pb.js";
|
|
4
6
|
import { snapshotThenStream } from "../../realtime/snapshot-then-stream.js";
|
|
5
7
|
import { ListMarketOverviewInputSchema, createMarketOverviewSchema } from "./market-overview.schemas.js";
|
|
6
8
|
import { createClient } from "@connectrpc/connect";
|
|
7
|
-
import * as v from "valibot";
|
|
8
9
|
//#region src/services/market-overview/market-overview.ts
|
|
9
10
|
/**
|
|
10
11
|
* Provides ticker-style per-market stats and a live merged overview stream.
|
|
@@ -28,11 +29,30 @@ var MarketOverviewService = class {
|
|
|
28
29
|
await this.#scales.ready();
|
|
29
30
|
const res = await this.#client.listMarketOverview(validatedInput, toConnectCallOptions(options));
|
|
30
31
|
return {
|
|
31
|
-
markets:
|
|
32
|
+
markets: this.#decodeMarkets(res.markets),
|
|
32
33
|
nextPageToken: res.nextPageToken
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
37
|
+
* Decodes market rows, skipping any whose symbolId the catalog cannot resolve
|
|
38
|
+
* (unknown or disabled pairs the backend still reports). Other errors propagate.
|
|
39
|
+
*/
|
|
40
|
+
#decodeMarkets(markets) {
|
|
41
|
+
const decoded = [];
|
|
42
|
+
const skipped = [];
|
|
43
|
+
for (const m of markets) try {
|
|
44
|
+
decoded.push(parse(this.#marketOverviewSchema, m));
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error instanceof CatalogLookupError && error.domain === "market" && error.lookup === "symbolId") {
|
|
47
|
+
skipped.push(m.symbolId);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
if (skipped.length > 0 && isDev()) console.warn(`[market-overview] skipped ${skipped.length} row(s) with unknown symbolId: ${skipped.join(", ")}`);
|
|
53
|
+
return decoded;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
36
56
|
* Subscribes to public:spot:market_overview:updates:proto, fetches an initial snapshot, buffers updates until ready, and emits the merged set of latest market rows. On reconnect it refetches the snapshot before resuming updates.
|
|
37
57
|
*/
|
|
38
58
|
subscribe(input) {
|
|
@@ -41,7 +61,7 @@ var MarketOverviewService = class {
|
|
|
41
61
|
const includeSparklines = input.includeSparklines ?? true;
|
|
42
62
|
const sparklineIntervals = input.sparklineIntervals ?? ["24h"];
|
|
43
63
|
const listMarketOverview = this.list.bind(this);
|
|
44
|
-
const
|
|
64
|
+
const parseMarkets = this.#decodeMarkets.bind(this);
|
|
45
65
|
function emit() {
|
|
46
66
|
input.onEvent(Array.from(bySymbolId.values()));
|
|
47
67
|
}
|
|
@@ -51,11 +71,9 @@ var MarketOverviewService = class {
|
|
|
51
71
|
function applyMarkets(markets) {
|
|
52
72
|
for (const market of markets) handleMarketUpdate(market);
|
|
53
73
|
}
|
|
54
|
-
function parseMarkets(markets) {
|
|
55
|
-
return markets.map((m) => parse(schema, m));
|
|
56
|
-
}
|
|
57
74
|
async function fetchSnapshot() {
|
|
58
75
|
return (await listMarketOverview({
|
|
76
|
+
symbolIds: input.symbolIds,
|
|
59
77
|
includeSparklines,
|
|
60
78
|
sparklineIntervals
|
|
61
79
|
})).markets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market-overview.js","names":["#client","Proto.MarketOverviewService","#realtime","#scales","#marketOverviewSchema","Proto.MarketOverviewBatchSchema"],"sources":["../../../src/services/market-overview/market-overview.ts"],"sourcesContent":["import * as Proto from \"../../gen/marketoverview/v1/marketoverview_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport
|
|
1
|
+
{"version":3,"file":"market-overview.js","names":["#client","Proto.MarketOverviewService","#realtime","#scales","#marketOverviewSchema","#decodeMarkets","Proto.MarketOverviewBatchSchema"],"sources":["../../../src/services/market-overview/market-overview.ts"],"sourcesContent":["import * as Proto from \"../../gen/marketoverview/v1/marketoverview_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport { parse } from \"../../shared/validation.js\";\nimport { CatalogLookupError } from \"../../catalogs/types.js\";\nimport { isDev } from \"../../utils/is-dev.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport { snapshotThenStream } from \"../../realtime/snapshot-then-stream.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { PublicApiTransports } from \"../../shared/transports.js\";\nimport {\n ListMarketOverviewInputSchema,\n createMarketOverviewSchema,\n type SparklineIntervalName,\n type ListMarketOverviewInput,\n type MarketOverview,\n} from \"./market-overview.schemas.js\";\n\ninterface SubscribeMarketOverviewInput extends BaseSubscribeInput<MarketOverview[]> {\n symbolIds?: number[];\n includeSparklines?: boolean;\n sparklineIntervals?: SparklineIntervalName[];\n}\n\n/**\n * Provides ticker-style per-market stats and a live merged overview stream.\n */\nexport class MarketOverviewService {\n #client: Client<typeof Proto.MarketOverviewService>;\n #realtime: PolyesterRealtime;\n #scales: SdkScales;\n #marketOverviewSchema: ReturnType<typeof createMarketOverviewSchema>;\n\n constructor(transports: PublicApiTransports, realtime: PolyesterRealtime, scales: SdkScales) {\n this.#client = createClient(Proto.MarketOverviewService, transports.publicApi);\n this.#realtime = realtime;\n this.#scales = scales;\n this.#marketOverviewSchema = createMarketOverviewSchema(scales);\n }\n\n /**\n * Returns market overview rows with last and index prices, 24h stats, top-of-book values, listing timestamp, and optional sparklines. Supports symbol ID filtering, sorting, pagination, and sparkline interval selection.\n */\n async list(\n input: ListMarketOverviewInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<{ markets: MarketOverview[]; nextPageToken: string }> {\n const validatedInput = parse(ListMarketOverviewInputSchema, input);\n await this.#scales.ready();\n const res = await this.#client.listMarketOverview(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n markets: this.#decodeMarkets(res.markets),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Decodes market rows, skipping any whose symbolId the catalog cannot resolve\n * (unknown or disabled pairs the backend still reports). Other errors propagate.\n */\n #decodeMarkets(markets: readonly Proto.MarketOverview[]): MarketOverview[] {\n const decoded: MarketOverview[] = [];\n const skipped: number[] = [];\n for (const m of markets) {\n try {\n decoded.push(parse(this.#marketOverviewSchema, m));\n } catch (error) {\n if (\n error instanceof CatalogLookupError &&\n error.domain === \"market\" &&\n error.lookup === \"symbolId\"\n ) {\n skipped.push(m.symbolId);\n continue;\n }\n throw error;\n }\n }\n if (skipped.length > 0 && isDev()) {\n console.warn(\n `[market-overview] skipped ${skipped.length} row(s) with unknown symbolId: ${skipped.join(\", \")}`,\n );\n }\n return decoded;\n }\n\n /**\n * Subscribes to public:spot:market_overview:updates:proto, fetches an initial snapshot, buffers updates until ready, and emits the merged set of latest market rows. On reconnect it refetches the snapshot before resuming updates.\n */\n subscribe(input: SubscribeMarketOverviewInput): () => void {\n const channel = \"public:spot:market_overview:updates:proto\";\n const bySymbolId = new Map<number, MarketOverview>();\n const includeSparklines = input.includeSparklines ?? true;\n const sparklineIntervals = input.sparklineIntervals ?? [\"24h\"];\n const listMarketOverview = this.list.bind(this);\n const parseMarkets = this.#decodeMarkets.bind(this);\n function emit(): void {\n input.onEvent(Array.from(bySymbolId.values()));\n }\n\n function handleMarketUpdate(m: MarketOverview): void {\n bySymbolId.set(m.symbolId, m);\n }\n\n function applyMarkets(markets: readonly MarketOverview[]): void {\n for (const market of markets) {\n handleMarketUpdate(market);\n }\n }\n\n async function fetchSnapshot(): Promise<MarketOverview[]> {\n const result = await listMarketOverview({\n symbolIds: input.symbolIds,\n includeSparklines,\n sparklineIntervals,\n });\n return result.markets;\n }\n\n const stream = snapshotThenStream({\n realtime: this.#realtime,\n channel,\n schema: Proto.MarketOverviewBatchSchema,\n maxBufferedPublications: 2000,\n snapshotErrorLog: \"Failed to fetch market overview\",\n fetchSnapshot,\n readPublication: (batch) => batch.markets ?? [],\n bufferPublicationKey: (market) => market.symbolId,\n applySnapshot: (markets, bufferedMarkets) => {\n bySymbolId.clear();\n applyMarkets(markets);\n applyMarkets(parseMarkets(bufferedMarkets));\n emit();\n },\n applyLivePublications: (markets) => {\n applyMarkets(parseMarkets(markets));\n emit();\n },\n onOpen: input.onOpen,\n onClose: input.onClose,\n onError: input.onError,\n });\n\n function dispose(): void {\n stream.unsubscribe();\n }\n\n return dispose;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,IAAa,wBAAb,MAAmC;CAC/B;CACA;CACA;CACA;CAEA,YAAY,YAAiC,UAA6B,QAAmB;EACzF,KAAKA,UAAU,aAAaC,yBAA6B,WAAW,SAAS;EAC7E,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,wBAAwB,2BAA2B,MAAM;CAClE;;;;CAKA,MAAM,KACF,QAAiC,CAAC,GAClC,SAC6D;EAC7D,MAAM,iBAAiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,KAAKD,QAAQ,MAAM;EACzB,MAAM,MAAM,MAAM,KAAKH,QAAQ,mBAC3B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,SAAS,KAAKK,eAAe,IAAI,OAAO;GACxC,eAAe,IAAI;EACvB;CACJ;;;;;CAMA,eAAe,SAA4D;EACvE,MAAM,UAA4B,CAAC;EACnC,MAAM,UAAoB,CAAC;EAC3B,KAAK,MAAM,KAAK,SACZ,IAAI;GACA,QAAQ,KAAK,MAAM,KAAKD,uBAAuB,CAAC,CAAC;EACrD,SAAS,OAAO;GACZ,IACI,iBAAiB,sBACjB,MAAM,WAAW,YACjB,MAAM,WAAW,YACnB;IACE,QAAQ,KAAK,EAAE,QAAQ;IACvB;GACJ;GACA,MAAM;EACV;EAEJ,IAAI,QAAQ,SAAS,KAAK,MAAM,GAC5B,QAAQ,KACJ,6BAA6B,QAAQ,OAAO,iCAAiC,QAAQ,KAAK,IAAI,GAClG;EAEJ,OAAO;CACX;;;;CAKA,UAAU,OAAiD;EACvD,MAAM,UAAU;EAChB,MAAM,6BAAa,IAAI,IAA4B;EACnD,MAAM,oBAAoB,MAAM,qBAAqB;EACrD,MAAM,qBAAqB,MAAM,sBAAsB,CAAC,KAAK;EAC7D,MAAM,qBAAqB,KAAK,KAAK,KAAK,IAAI;EAC9C,MAAM,eAAe,KAAKC,eAAe,KAAK,IAAI;EAClD,SAAS,OAAa;GAClB,MAAM,QAAQ,MAAM,KAAK,WAAW,OAAO,CAAC,CAAC;EACjD;EAEA,SAAS,mBAAmB,GAAyB;GACjD,WAAW,IAAI,EAAE,UAAU,CAAC;EAChC;EAEA,SAAS,aAAa,SAA0C;GAC5D,KAAK,MAAM,UAAU,SACjB,mBAAmB,MAAM;EAEjC;EAEA,eAAe,gBAA2C;GAMtD,QAAO,MALc,mBAAmB;IACpC,WAAW,MAAM;IACjB;IACA;GACJ,CAAC,EAAA,CACa;EAClB;EAEA,MAAM,SAAS,mBAAmB;GAC9B,UAAU,KAAKH;GACf;GACA,QAAQI;GACR,yBAAyB;GACzB,kBAAkB;GAClB;GACA,kBAAkB,UAAU,MAAM,WAAW,CAAC;GAC9C,uBAAuB,WAAW,OAAO;GACzC,gBAAgB,SAAS,oBAAoB;IACzC,WAAW,MAAM;IACjB,aAAa,OAAO;IACpB,aAAa,aAAa,eAAe,CAAC;IAC1C,KAAK;GACT;GACA,wBAAwB,YAAY;IAChC,aAAa,aAAa,OAAO,CAAC;IAClC,KAAK;GACT;GACA,QAAQ,MAAM;GACd,SAAS,MAAM;GACf,SAAS,MAAM;EACnB,CAAC;EAED,SAAS,UAAgB;GACrB,OAAO,YAAY;EACvB;EAEA,OAAO;CACX;AACJ"}
|
|
@@ -10,7 +10,7 @@ declare const GetOrderbookInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
|
|
|
10
10
|
depth: number;
|
|
11
11
|
}, {
|
|
12
12
|
symbolId: number;
|
|
13
|
-
depth: 5 | 10 | 20 | 1 | 200 | 1000 | 500 |
|
|
13
|
+
depth: 5 | 10 | 20 | 1 | 200 | 1000 | 500 | 100 | 50;
|
|
14
14
|
protoDepth: Depth;
|
|
15
15
|
}>]>;
|
|
16
16
|
type GetOrderbookInput = v.InferInput<typeof GetOrderbookInputSchema>;
|
|
@@ -243,7 +243,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
243
243
|
attachedRisk: {
|
|
244
244
|
takeProfit: {
|
|
245
245
|
state: {
|
|
246
|
-
status: "unspecified" | "
|
|
246
|
+
status: "unspecified" | "failed" | "created" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
|
|
247
247
|
armedTs: number | undefined;
|
|
248
248
|
armedTsNs: string | undefined;
|
|
249
249
|
terminalTs: number | undefined;
|
|
@@ -262,7 +262,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
262
262
|
} | undefined;
|
|
263
263
|
stopLoss: {
|
|
264
264
|
state: {
|
|
265
|
-
status: "unspecified" | "
|
|
265
|
+
status: "unspecified" | "failed" | "created" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
|
|
266
266
|
armedTs: number | undefined;
|
|
267
267
|
armedTsNs: string | undefined;
|
|
268
268
|
terminalTs: number | undefined;
|
|
@@ -281,7 +281,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
281
281
|
} | undefined;
|
|
282
282
|
trailingStop: {
|
|
283
283
|
state: {
|
|
284
|
-
status: "unspecified" | "
|
|
284
|
+
status: "unspecified" | "failed" | "created" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
|
|
285
285
|
armedTs: number | undefined;
|
|
286
286
|
armedTsNs: string | undefined;
|
|
287
287
|
terminalTs: number | undefined;
|
|
@@ -586,7 +586,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
586
586
|
attachedRisk: {
|
|
587
587
|
takeProfit: {
|
|
588
588
|
state: {
|
|
589
|
-
status: "unspecified" | "
|
|
589
|
+
status: "unspecified" | "failed" | "created" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
|
|
590
590
|
armedTs: number | undefined;
|
|
591
591
|
armedTsNs: string | undefined;
|
|
592
592
|
terminalTs: number | undefined;
|
|
@@ -605,7 +605,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
605
605
|
} | undefined;
|
|
606
606
|
stopLoss: {
|
|
607
607
|
state: {
|
|
608
|
-
status: "unspecified" | "
|
|
608
|
+
status: "unspecified" | "failed" | "created" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
|
|
609
609
|
armedTs: number | undefined;
|
|
610
610
|
armedTsNs: string | undefined;
|
|
611
611
|
terminalTs: number | undefined;
|
|
@@ -624,7 +624,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
624
624
|
} | undefined;
|
|
625
625
|
trailingStop: {
|
|
626
626
|
state: {
|
|
627
|
-
status: "unspecified" | "
|
|
627
|
+
status: "unspecified" | "failed" | "created" | "completed" | "armed" | "running" | "paused" | "canceled" | "not_configured";
|
|
628
628
|
armedTs: number | undefined;
|
|
629
629
|
armedTsNs: string | undefined;
|
|
630
630
|
terminalTs: number | undefined;
|
|
@@ -212,7 +212,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
212
212
|
readonly granteeAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
213
213
|
readonly inviterAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
214
214
|
readonly role: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountRole$1, undefined>, v.TransformAction<SubaccountRole$1, "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer">]>;
|
|
215
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountInviteStatus$1, undefined>, v.TransformAction<SubaccountInviteStatus$1, "unspecified" | "pending" | "
|
|
215
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountInviteStatus$1, undefined>, v.TransformAction<SubaccountInviteStatus$1, "unspecified" | "pending" | "cancelled" | "accepted" | "declined">]>;
|
|
216
216
|
readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
217
217
|
readonly seconds: v.BigintSchema<undefined>;
|
|
218
218
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -239,7 +239,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
239
239
|
granteeAccountId: string;
|
|
240
240
|
inviterAccountId: string;
|
|
241
241
|
role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
|
|
242
|
-
status: "unspecified" | "pending" | "
|
|
242
|
+
status: "unspecified" | "pending" | "cancelled" | "accepted" | "declined";
|
|
243
243
|
createdAt?: number | undefined;
|
|
244
244
|
respondedAt?: number | undefined;
|
|
245
245
|
granteeUsername: string;
|
|
@@ -257,7 +257,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
257
257
|
granteeAccountId: string;
|
|
258
258
|
inviterAccountId: string;
|
|
259
259
|
role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
|
|
260
|
-
status: "unspecified" | "pending" | "
|
|
260
|
+
status: "unspecified" | "pending" | "cancelled" | "accepted" | "declined";
|
|
261
261
|
createdAt?: number | undefined;
|
|
262
262
|
respondedAt?: number | undefined;
|
|
263
263
|
granteeUsername: string;
|
|
@@ -280,7 +280,7 @@ declare const SubaccountActivityEventSchema: v.ObjectSchema<{
|
|
|
280
280
|
nanos: number;
|
|
281
281
|
} | undefined, number | undefined>]>;
|
|
282
282
|
readonly entityKind: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEntityKind, undefined>, v.TransformAction<ActivityEntityKind, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "member" | "policy" | "invite" | "security">]>;
|
|
283
|
-
readonly eventAction: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventAction, undefined>, v.TransformAction<ActivityEventAction, "unspecified" | "enabled" | "disabled" | "
|
|
283
|
+
readonly eventAction: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventAction, undefined>, v.TransformAction<ActivityEventAction, "unspecified" | "enabled" | "disabled" | "failed" | "revoked" | "created" | "updated" | "deleted" | "removed" | "role_set" | "received" | "replied" | "blocked" | "hold_placed" | "hold_released">]>;
|
|
284
284
|
readonly source: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventSource, undefined>, v.TransformAction<ActivityEventSource, "unspecified" | "web" | "mobile" | "api">]>;
|
|
285
285
|
readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
286
286
|
readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -4,8 +4,7 @@ import { SubaccountResolver } from "../subaccount-resolver.js";
|
|
|
4
4
|
import { PolyesterRealtime } from "../../realtime/types.js";
|
|
5
5
|
import { BaseSubscribeInput } from "../../shared/types.js";
|
|
6
6
|
import { SdkScales } from "../../shared/decimal-surface.js";
|
|
7
|
-
import {
|
|
8
|
-
import * as v from "valibot";
|
|
7
|
+
import { GetUserTradesInput, Trade } from "./trades.schemas.js";
|
|
9
8
|
//#region src/services/trades/trades.d.ts
|
|
10
9
|
interface SubscribeTradesInput extends BaseSubscribeInput<Trade> {
|
|
11
10
|
accountId: string;
|
|
@@ -17,9 +16,9 @@ declare class TradesService {
|
|
|
17
16
|
#private;
|
|
18
17
|
constructor(transports: AuthApiTransports, realtime: PolyesterRealtime, resolver: SubaccountResolver | undefined, scales: SdkScales);
|
|
19
18
|
/**
|
|
20
|
-
* Returns user trades for the resolved root account or subaccount, supporting symbol, side, time range, limit, page token, and after-match-ID replay cursor filters. Results include the next page token from GetUserTrades.
|
|
19
|
+
* Returns user trades for the resolved root account or subaccount, supporting symbol, side, time range, limit, page token, and after-match-ID replay cursor filters. The `afterMatchId` cursor requires `symbolId`, enforced at the type and validation level. Results include the next page token from GetUserTrades.
|
|
21
20
|
*/
|
|
22
|
-
list(input?:
|
|
21
|
+
list(input?: GetUserTradesInput, options?: PolyesterRequestOptions): Promise<{
|
|
23
22
|
trades: Trade[];
|
|
24
23
|
nextPageToken: string;
|
|
25
24
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trades.d.ts","names":[],"sources":["../../../src/services/trades/trades.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"trades.d.ts","names":[],"sources":["../../../src/services/trades/trades.ts"],"mappings":";;;;;;;;UAsBU,6BAA6B,mBAAmB;EACtD;;;;;cAMS;;EAQL,YAAA,YAAY,mBACZ,UAAU,mBACV,UAAU,gCACV,QAAQ;;;;EAYN,KACF,QAAO,oBACP,UAAU,0BACX;IAAU,QAAQ;IAAS;;;;;EAiB9B,UAAU,OAAO"}
|
|
@@ -25,7 +25,7 @@ var TradesService = class {
|
|
|
25
25
|
this.#userTradeSchema = createUserTradeSchema(scales);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Returns user trades for the resolved root account or subaccount, supporting symbol, side, time range, limit, page token, and after-match-ID replay cursor filters. Results include the next page token from GetUserTrades.
|
|
28
|
+
* Returns user trades for the resolved root account or subaccount, supporting symbol, side, time range, limit, page token, and after-match-ID replay cursor filters. The `afterMatchId` cursor requires `symbolId`, enforced at the type and validation level. Results include the next page token from GetUserTrades.
|
|
29
29
|
*/
|
|
30
30
|
async list(input = {}, options) {
|
|
31
31
|
await this.#scales.ready();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trades.js","names":["#client","Proto.OrdersReadService","#realtime","#resolver","#scales","#userTradeSchema","Proto.UserTradeSchema"],"sources":["../../../src/services/trades/trades.ts"],"sourcesContent":["import * as Proto from \"../../gen/orders/v1/orders_read_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport { connectReadyGatedProtoChannel } from \"../../realtime/ready-gated-subscription.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"trades.js","names":["#client","Proto.OrdersReadService","#realtime","#resolver","#scales","#userTradeSchema","Proto.UserTradeSchema"],"sources":["../../../src/services/trades/trades.ts"],"sourcesContent":["import * as Proto from \"../../gen/orders/v1/orders_read_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport { connectReadyGatedProtoChannel } from \"../../realtime/ready-gated-subscription.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport {\n GetUserTradesInputSchema,\n createUserTradeSchema,\n type GetUserTradesInput,\n type Trade,\n} from \"./trades.schemas.js\";\n\ninterface SubscribeTradesInput extends BaseSubscribeInput<Trade> {\n accountId: string;\n}\n\n/**\n * Reads and streams authenticated user trade fills.\n */\nexport class TradesService {\n #client: Client<typeof Proto.OrdersReadService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #userTradeSchema: ReturnType<typeof createUserTradeSchema>;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#client = createClient(Proto.OrdersReadService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n this.#scales = scales;\n this.#userTradeSchema = createUserTradeSchema(scales);\n }\n\n /**\n * Returns user trades for the resolved root account or subaccount, supporting symbol, side, time range, limit, page token, and after-match-ID replay cursor filters. The `afterMatchId` cursor requires `symbolId`, enforced at the type and validation level. Results include the next page token from GetUserTrades.\n */\n async list(\n input: GetUserTradesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<{ trades: Trade[]; nextPageToken: string }> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(GetUserTradesInputSchema, resolved);\n const res = await this.#client.getUserTrades(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return {\n trades: parse(v.array(this.#userTradeSchema), res.trades),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private user trade updates on private:spot:trades:{accountId}:proto and emits parsed fills.\n */\n subscribe(input: SubscribeTradesInput) {\n const channel = `private:spot:trades:${input.accountId}:proto`;\n return connectReadyGatedProtoChannel(this.#realtime, {\n channel,\n schema: Proto.UserTradeSchema,\n ready: () => this.#scales.ready(),\n onPublication: (data) => {\n const trade = parse(this.#userTradeSchema, data);\n input.onEvent(trade);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,IAAa,gBAAb,MAA2B;CACvB;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACA,QACF;EACE,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,YAAY;EACjB,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,mBAAmB,sBAAsB,MAAM;CACxD;;;;CAKA,MAAM,KACF,QAA4B,CAAC,GAC7B,SACmD;EACnD,MAAM,KAAKD,QAAQ,MAAM;EACzB,MAAM,WAAW,0BAA0B,OAAO,KAAKD,SAAS;EAChE,MAAM,iBAAiB,MAAM,0BAA0B,QAAQ;EAC/D,MAAM,MAAM,MAAM,KAAKH,QAAQ,cAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,QAAQ,MAAM,EAAE,MAAM,KAAKK,gBAAgB,GAAG,IAAI,MAAM;GACxD,eAAe,IAAI;EACvB;CACJ;;;;CAKA,UAAU,OAA6B;EACnC,MAAM,UAAU,uBAAuB,MAAM,UAAU;EACvD,OAAO,8BAA8B,KAAKH,WAAW;GACjD;GACA,QAAQI;GACR,aAAa,KAAKF,QAAQ,MAAM;GAChC,gBAAgB,SAAS;IACrB,MAAM,QAAQ,MAAM,KAAKC,kBAAkB,IAAI;IAC/C,MAAM,QAAQ,KAAK;GACvB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
@@ -60,39 +60,73 @@ declare function createUserTradeSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
60
60
|
/** A JSON-safe authenticated trade fill returned by the SDK. */
|
|
61
61
|
type Trade = v.InferOutput<ReturnType<typeof createUserTradeSchema>>;
|
|
62
62
|
/** Validates filters accepted by {@link TradesService.list}. */
|
|
63
|
-
declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
64
|
-
readonly symbolId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<
|
|
63
|
+
declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema<[v.StrictObjectSchema<{
|
|
64
|
+
readonly symbolId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, number>]>, undefined>, v.TransformAction<number | undefined, number | undefined>]>;
|
|
65
|
+
readonly afterMatchId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
65
66
|
readonly side: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<["buy", "sell"], undefined>, undefined>, v.TransformAction<"buy" | "sell" | undefined, Side.BUY | Side.SELL | undefined>]>;
|
|
66
67
|
readonly startTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
67
68
|
readonly endTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
68
69
|
readonly limit: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
69
70
|
readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
|
|
70
|
-
readonly afterMatchId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
71
71
|
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
72
72
|
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
73
73
|
}, undefined>], undefined>, undefined>;
|
|
74
|
-
}, undefined>, v.
|
|
74
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
75
|
+
readonly symbolId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.TransformAction<string, number>]>, v.CheckAction<number, "symbolId is required when afterMatchId is set">]>;
|
|
76
|
+
readonly afterMatchId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint | undefined>]>;
|
|
77
|
+
readonly side: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<["buy", "sell"], undefined>, undefined>, v.TransformAction<"buy" | "sell" | undefined, Side.BUY | Side.SELL | undefined>]>;
|
|
78
|
+
readonly startTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
79
|
+
readonly endTsNs: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
80
|
+
readonly limit: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
81
|
+
readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
|
|
82
|
+
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
83
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
84
|
+
}, undefined>], undefined>, undefined>;
|
|
85
|
+
}, undefined>], "symbolId is required when afterMatchId is set">, v.TransformAction<{
|
|
75
86
|
symbolId?: number | undefined;
|
|
87
|
+
afterMatchId?: undefined;
|
|
88
|
+
side?: Side.BUY | Side.SELL | undefined;
|
|
89
|
+
startTsNs?: bigint | undefined;
|
|
90
|
+
endTsNs?: bigint | undefined;
|
|
91
|
+
limit?: number | undefined;
|
|
92
|
+
pageToken?: string | undefined;
|
|
93
|
+
account?: "active" | "main" | {
|
|
94
|
+
subaccountId: string;
|
|
95
|
+
} | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
symbolId: number;
|
|
98
|
+
afterMatchId: bigint | undefined;
|
|
76
99
|
side?: Side.BUY | Side.SELL | undefined;
|
|
77
100
|
startTsNs?: bigint | undefined;
|
|
78
101
|
endTsNs?: bigint | undefined;
|
|
79
102
|
limit?: number | undefined;
|
|
80
103
|
pageToken?: string | undefined;
|
|
81
|
-
afterMatchId?: bigint | undefined;
|
|
82
104
|
account?: "active" | "main" | {
|
|
83
105
|
subaccountId: string;
|
|
84
106
|
} | undefined;
|
|
85
107
|
}, {
|
|
86
108
|
subaccountId: bigint | undefined;
|
|
87
109
|
symbolId?: number | undefined;
|
|
110
|
+
afterMatchId?: undefined;
|
|
111
|
+
side?: Side.BUY | Side.SELL | undefined;
|
|
112
|
+
startTsNs?: bigint | undefined;
|
|
113
|
+
endTsNs?: bigint | undefined;
|
|
114
|
+
limit?: number | undefined;
|
|
115
|
+
pageToken?: string | undefined;
|
|
116
|
+
} | {
|
|
117
|
+
subaccountId: bigint | undefined;
|
|
118
|
+
symbolId: number;
|
|
119
|
+
afterMatchId: bigint | undefined;
|
|
88
120
|
side?: Side.BUY | Side.SELL | undefined;
|
|
89
121
|
startTsNs?: bigint | undefined;
|
|
90
122
|
endTsNs?: bigint | undefined;
|
|
91
123
|
limit?: number | undefined;
|
|
92
124
|
pageToken?: string | undefined;
|
|
93
|
-
afterMatchId?: bigint | undefined;
|
|
94
125
|
}>]>;
|
|
95
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Filters accepted by {@link TradesService.list}. Passing `afterMatchId` requires
|
|
128
|
+
* `symbolId`; the two shapes form a discriminated union so the constraint is a compile error.
|
|
129
|
+
*/
|
|
96
130
|
type GetUserTradesInput = v.InferInput<typeof GetUserTradesInputSchema>;
|
|
97
131
|
//#endregion
|
|
98
132
|
export { GetUserTradesInput, GetUserTradesInputSchema, Trade, createUserTradeSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trades.schemas.d.ts","names":[],"sources":["../../../src/services/trades/trades.schemas.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"trades.schemas.d.ts","names":[],"sources":["../../../src/services/trades/trades.schemas.ts"],"mappings":";;;;;iBAsBgB,sBAAsB,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwD3C,QAAQ,EAAE,YAAY,kBAAkB;;cAkDvC,0BAAwB,EAAA,yBAAA,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAezB,qBAAqB,EAAE,kBAAkB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { requiredEnumLabel } from "../../shared/proto-enum-codec.js";
|
|
2
2
|
import { formatId } from "../../utils/base58-id.js";
|
|
3
|
+
import { parseOptionalUint64DecimalStrict } from "../../utils/numbers.js";
|
|
3
4
|
import { tsNsToISO, tsNsToMs } from "../../utils/time.js";
|
|
4
5
|
import { optionalUint64DecimalFilterSchema } from "../../shared/schemas.js";
|
|
5
6
|
import { SideSchema } from "../shared.js";
|
|
@@ -49,21 +50,30 @@ function createUserTradeSchema(scales) {
|
|
|
49
50
|
};
|
|
50
51
|
}));
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
const
|
|
53
|
+
const AFTER_MATCH_REQUIRES_SYMBOL = "symbolId is required when afterMatchId is set";
|
|
54
|
+
const SymbolIdStringSchema = v.pipe(v.string(), v.trim(), v.transform((value) => Number(value)));
|
|
55
|
+
const GetUserTradesCommonEntries = {
|
|
54
56
|
...AccountScopeInputEntries,
|
|
55
|
-
symbolId: v.pipe(v.optional(v.pipe(v.string(), v.trim())), v.transform((v) => {
|
|
56
|
-
if (!v) return void 0;
|
|
57
|
-
const sid = Number(v);
|
|
58
|
-
return Number.isFinite(sid) && sid > 0 ? sid : void 0;
|
|
59
|
-
})),
|
|
60
57
|
side: v.pipe(v.optional(SideSchema), v.transform((v) => v ? TradeSideCodec.inputToProto[v] : void 0)),
|
|
61
58
|
startTsNs: optionalUint64DecimalFilterSchema("startTsNs"),
|
|
62
59
|
endTsNs: optionalUint64DecimalFilterSchema("endTsNs"),
|
|
63
60
|
limit: v.optional(v.number()),
|
|
64
|
-
pageToken: v.optional(v.pipe(v.string(), v.trim()))
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
pageToken: v.optional(v.pipe(v.string(), v.trim()))
|
|
62
|
+
};
|
|
63
|
+
/** Browse mode: optional symbol filter, no replay cursor. */
|
|
64
|
+
const BrowseUserTradesInputSchema = v.strictObject({
|
|
65
|
+
...GetUserTradesCommonEntries,
|
|
66
|
+
symbolId: v.pipe(v.optional(SymbolIdStringSchema), v.transform((sid) => sid !== void 0 && Number.isFinite(sid) && sid > 0 ? sid : void 0)),
|
|
67
|
+
afterMatchId: v.optional(v.never())
|
|
68
|
+
});
|
|
69
|
+
/** Replay mode: `afterMatchId` cursor, which the backend only accepts scoped to a symbol. */
|
|
70
|
+
const ReplayUserTradesInputSchema = v.strictObject({
|
|
71
|
+
...GetUserTradesCommonEntries,
|
|
72
|
+
symbolId: v.pipe(SymbolIdStringSchema, v.check((sid) => Number.isInteger(sid) && sid > 0, AFTER_MATCH_REQUIRES_SYMBOL)),
|
|
73
|
+
afterMatchId: v.pipe(v.string(), v.trim(), v.minLength(1), v.transform((value) => parseOptionalUint64DecimalStrict(value, "afterMatchId")))
|
|
74
|
+
});
|
|
75
|
+
/** Validates filters accepted by {@link TradesService.list}. */
|
|
76
|
+
const GetUserTradesInputSchema = v.pipe(v.union([BrowseUserTradesInputSchema, ReplayUserTradesInputSchema], AFTER_MATCH_REQUIRES_SYMBOL), v.transform(({ account, ...input }) => ({
|
|
67
77
|
...input,
|
|
68
78
|
subaccountId: accountScopeToSubaccountId(account)
|
|
69
79
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trades.schemas.js","names":[],"sources":["../../../src/services/trades/trades.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { tsNsToISO, tsNsToMs } from \"../../utils/time.js\";\nimport { SideSchema } from \"../shared.js\";\nimport { FeeAssetCodec, OrderSideCodec } from \"../orders/orders.codecs.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { optionalUint64DecimalFilterSchema } from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { TradeSideCodec } from \"./trades.codecs.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { E18_SCALE, scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { fromU128 } from \"../../utils/u128.js\";\n\nconst U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\n/** Parses a generated user-trade fill into the SDK's JSON-safe public shape. */\nexport function createUserTradeSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n orderId: v.bigint(),\n symbolId: v.number(),\n side: v.number(),\n isMaker: v.boolean(),\n feeAsset: v.number(),\n qtyScaled: v.bigint(),\n priceTicks: v.bigint(),\n feeAmountE18: v.optional(U128Schema),\n referralShareAmountE18: v.optional(U128Schema),\n feeIsRebate: v.boolean(),\n tsNs: v.bigint(),\n matchId: v.bigint(),\n }),\n v.transform((t) => {\n const feeAsset = requiredEnumLabel(\n FeeAssetCodec.protoToOutput,\n t.feeAsset,\n \"UserTradeSchema\",\n \"fee asset\",\n );\n return {\n orderId: formatId(t.orderId),\n symbolId: t.symbolId,\n sideLabel: requiredEnumLabel(\n OrderSideCodec.protoToOutput,\n t.side,\n \"UserTradeSchema\",\n \"side\",\n ),\n liquidityLabel: t.isMaker ? (\"maker\" as const) : (\"taker\" as const),\n feeAsset,\n qty: scaledToDecimalOutput(t.qtyScaled, scales.baseQty(t.symbolId)),\n price: scaledToDecimalOutput(t.priceTicks, scales.price()),\n fee: scaledToDecimalOutput(fromU128(t.feeAmountE18), E18_SCALE),\n ...(t.referralShareAmountE18 === undefined\n ? {}\n : {\n referralShare: scaledToDecimalOutput(\n fromU128(t.referralShareAmountE18),\n E18_SCALE,\n ),\n }),\n feeIsRebate: t.feeIsRebate,\n tsNs: t.tsNs.toString(),\n tsIso: tsNsToISO(t.tsNs),\n tsMs: tsNsToMs(t.tsNs),\n matchId: t.matchId.toString(),\n };\n }),\n );\n}\n\n/** A JSON-safe authenticated trade fill returned by the SDK. */\nexport type Trade = v.InferOutput<ReturnType<typeof createUserTradeSchema>>;\n\
|
|
1
|
+
{"version":3,"file":"trades.schemas.js","names":[],"sources":["../../../src/services/trades/trades.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { tsNsToISO, tsNsToMs } from \"../../utils/time.js\";\nimport { SideSchema } from \"../shared.js\";\nimport { FeeAssetCodec, OrderSideCodec } from \"../orders/orders.codecs.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { optionalUint64DecimalFilterSchema } from \"../../shared/schemas.js\";\nimport { parseOptionalUint64DecimalStrict } from \"../../utils/numbers.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { TradeSideCodec } from \"./trades.codecs.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { E18_SCALE, scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { fromU128 } from \"../../utils/u128.js\";\n\nconst U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\n/** Parses a generated user-trade fill into the SDK's JSON-safe public shape. */\nexport function createUserTradeSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n orderId: v.bigint(),\n symbolId: v.number(),\n side: v.number(),\n isMaker: v.boolean(),\n feeAsset: v.number(),\n qtyScaled: v.bigint(),\n priceTicks: v.bigint(),\n feeAmountE18: v.optional(U128Schema),\n referralShareAmountE18: v.optional(U128Schema),\n feeIsRebate: v.boolean(),\n tsNs: v.bigint(),\n matchId: v.bigint(),\n }),\n v.transform((t) => {\n const feeAsset = requiredEnumLabel(\n FeeAssetCodec.protoToOutput,\n t.feeAsset,\n \"UserTradeSchema\",\n \"fee asset\",\n );\n return {\n orderId: formatId(t.orderId),\n symbolId: t.symbolId,\n sideLabel: requiredEnumLabel(\n OrderSideCodec.protoToOutput,\n t.side,\n \"UserTradeSchema\",\n \"side\",\n ),\n liquidityLabel: t.isMaker ? (\"maker\" as const) : (\"taker\" as const),\n feeAsset,\n qty: scaledToDecimalOutput(t.qtyScaled, scales.baseQty(t.symbolId)),\n price: scaledToDecimalOutput(t.priceTicks, scales.price()),\n fee: scaledToDecimalOutput(fromU128(t.feeAmountE18), E18_SCALE),\n ...(t.referralShareAmountE18 === undefined\n ? {}\n : {\n referralShare: scaledToDecimalOutput(\n fromU128(t.referralShareAmountE18),\n E18_SCALE,\n ),\n }),\n feeIsRebate: t.feeIsRebate,\n tsNs: t.tsNs.toString(),\n tsIso: tsNsToISO(t.tsNs),\n tsMs: tsNsToMs(t.tsNs),\n matchId: t.matchId.toString(),\n };\n }),\n );\n}\n\n/** A JSON-safe authenticated trade fill returned by the SDK. */\nexport type Trade = v.InferOutput<ReturnType<typeof createUserTradeSchema>>;\n\nconst AFTER_MATCH_REQUIRES_SYMBOL = \"symbolId is required when afterMatchId is set\";\n\nconst SymbolIdStringSchema = v.pipe(\n v.string(),\n v.trim(),\n v.transform((value) => Number(value)),\n);\n\nconst GetUserTradesCommonEntries = {\n ...AccountScopeInputEntries,\n side: v.pipe(\n v.optional(SideSchema),\n v.transform((v) => (v ? TradeSideCodec.inputToProto[v] : undefined)),\n ),\n startTsNs: optionalUint64DecimalFilterSchema(\"startTsNs\"),\n endTsNs: optionalUint64DecimalFilterSchema(\"endTsNs\"),\n limit: v.optional(v.number()),\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n};\n\n/** Browse mode: optional symbol filter, no replay cursor. */\nconst BrowseUserTradesInputSchema = v.strictObject({\n ...GetUserTradesCommonEntries,\n symbolId: v.pipe(\n v.optional(SymbolIdStringSchema),\n v.transform((sid) =>\n sid !== undefined && Number.isFinite(sid) && sid > 0 ? sid : undefined,\n ),\n ),\n afterMatchId: v.optional(v.never()),\n});\n\n/** Replay mode: `afterMatchId` cursor, which the backend only accepts scoped to a symbol. */\nconst ReplayUserTradesInputSchema = v.strictObject({\n ...GetUserTradesCommonEntries,\n symbolId: v.pipe(\n SymbolIdStringSchema,\n v.check((sid) => Number.isInteger(sid) && sid > 0, AFTER_MATCH_REQUIRES_SYMBOL),\n ),\n afterMatchId: v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((value) => parseOptionalUint64DecimalStrict(value, \"afterMatchId\")),\n ),\n});\n\n/** Validates filters accepted by {@link TradesService.list}. */\nexport const GetUserTradesInputSchema = v.pipe(\n v.union(\n [BrowseUserTradesInputSchema, ReplayUserTradesInputSchema],\n AFTER_MATCH_REQUIRES_SYMBOL,\n ),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\n/**\n * Filters accepted by {@link TradesService.list}. Passing `afterMatchId` requires\n * `symbolId`; the two shapes form a discriminated union so the constraint is a compile error.\n */\nexport type GetUserTradesInput = v.InferInput<typeof GetUserTradesInputSchema>;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,aAAa,EAAE,OAAO;CACxB,IAAI,EAAE,OAAO;CACb,IAAI,EAAE,OAAO;AACjB,CAAC;;AAGD,SAAgB,sBAAsB,QAAmB;CACrD,OAAO,EAAE,KACL,EAAE,OAAO;EACL,SAAS,EAAE,OAAO;EAClB,UAAU,EAAE,OAAO;EACnB,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,QAAQ;EACnB,UAAU,EAAE,OAAO;EACnB,WAAW,EAAE,OAAO;EACpB,YAAY,EAAE,OAAO;EACrB,cAAc,EAAE,SAAS,UAAU;EACnC,wBAAwB,EAAE,SAAS,UAAU;EAC7C,aAAa,EAAE,QAAQ;EACvB,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,OAAO;CACtB,CAAC,GACD,EAAE,WAAW,MAAM;EACf,MAAM,WAAW,kBACb,cAAc,eACd,EAAE,UACF,mBACA,WACJ;EACA,OAAO;GACH,SAAS,SAAS,EAAE,OAAO;GAC3B,UAAU,EAAE;GACZ,WAAW,kBACP,eAAe,eACf,EAAE,MACF,mBACA,MACJ;GACA,gBAAgB,EAAE,UAAW,UAAqB;GAClD;GACA,KAAK,sBAAsB,EAAE,WAAW,OAAO,QAAQ,EAAE,QAAQ,CAAC;GAClE,OAAO,sBAAsB,EAAE,YAAY,OAAO,MAAM,CAAC;GACzD,KAAK,sBAAsB,SAAS,EAAE,YAAY,GAAA,EAAY;GAC9D,GAAI,EAAE,2BAA2B,KAAA,IAC3B,CAAC,IACD,EACI,eAAe,sBACX,SAAS,EAAE,sBAAsB,GAAA,EAErC,EACJ;GACN,aAAa,EAAE;GACf,MAAM,EAAE,KAAK,SAAS;GACtB,OAAO,UAAU,EAAE,IAAI;GACvB,MAAM,SAAS,EAAE,IAAI;GACrB,SAAS,EAAE,QAAQ,SAAS;EAChC;CACJ,CAAC,CACL;AACJ;AAKA,MAAM,8BAA8B;AAEpC,MAAM,uBAAuB,EAAE,KAC3B,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,WAAW,UAAU,OAAO,KAAK,CAAC,CACxC;AAEA,MAAM,6BAA6B;CAC/B,GAAG;CACH,MAAM,EAAE,KACJ,EAAE,SAAS,UAAU,GACrB,EAAE,WAAW,MAAO,IAAI,eAAe,aAAa,KAAK,KAAA,CAAU,CACvE;CACA,WAAW,kCAAkC,WAAW;CACxD,SAAS,kCAAkC,SAAS;CACpD,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC;CAC5B,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;AACtD;;AAGA,MAAM,8BAA8B,EAAE,aAAa;CAC/C,GAAG;CACH,UAAU,EAAE,KACR,EAAE,SAAS,oBAAoB,GAC/B,EAAE,WAAW,QACT,QAAQ,KAAA,KAAa,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM,KAAA,CACjE,CACJ;CACA,cAAc,EAAE,SAAS,EAAE,MAAM,CAAC;AACtC,CAAC;;AAGD,MAAM,8BAA8B,EAAE,aAAa;CAC/C,GAAG;CACH,UAAU,EAAE,KACR,sBACA,EAAE,OAAO,QAAQ,OAAO,UAAU,GAAG,KAAK,MAAM,GAAG,2BAA2B,CAClF;CACA,cAAc,EAAE,KACZ,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,UAAU,CAAC,GACb,EAAE,WAAW,UAAU,iCAAiC,OAAO,cAAc,CAAC,CAClF;AACJ,CAAC;;AAGD,MAAa,2BAA2B,EAAE,KACtC,EAAE,MACE,CAAC,6BAA6B,2BAA2B,GACzD,2BACJ,GACA,EAAE,WAAW,EAAE,SAAS,GAAG,aAAa;CACpC,GAAG;CACH,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN"}
|
|
@@ -809,7 +809,7 @@ type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInpu
|
|
|
809
809
|
declare const ListTriggersInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
810
810
|
readonly parentOrderId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
811
811
|
readonly symbolId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
|
|
812
|
-
readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("
|
|
812
|
+
readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
|
|
813
813
|
readonly triggerType: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["stop_loss", "take_profit", "trailing_stop", "twap", "ladder"], undefined>, undefined>, v.TransformAction<"twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop" | undefined, TriggerType>]>;
|
|
814
814
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, 50>;
|
|
815
815
|
readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
|
|
@@ -1030,7 +1030,7 @@ declare const ListTriggerEventsInputSchema: v.SchemaWithPipe<readonly [v.StrictO
|
|
|
1030
1030
|
readonly triggerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
1031
1031
|
}, undefined>, v.TransformAction<{
|
|
1032
1032
|
limit?: number | undefined;
|
|
1033
|
-
eventType?: "
|
|
1033
|
+
eventType?: "failed" | "updated" | "fired" | "canceled" | undefined;
|
|
1034
1034
|
pageToken: string;
|
|
1035
1035
|
account?: "active" | "main" | {
|
|
1036
1036
|
subaccountId: string;
|
|
@@ -31,62 +31,62 @@ declare const CreateTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
31
31
|
type CreateTriggerResult = v.InferOutput<typeof CreateTriggerResultSchema>;
|
|
32
32
|
declare const CancelTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
33
33
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
34
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "
|
|
34
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused">]>;
|
|
35
35
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
36
36
|
}, undefined>, v.TransformAction<{
|
|
37
37
|
triggerId: string;
|
|
38
|
-
status: "unspecified" | "
|
|
38
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
39
39
|
tsNs: bigint;
|
|
40
40
|
}, {
|
|
41
41
|
ts: number;
|
|
42
42
|
tsNs: string;
|
|
43
43
|
triggerId: string;
|
|
44
|
-
status: "unspecified" | "
|
|
44
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
45
45
|
}>]>;
|
|
46
46
|
type CancelTriggerResult = v.InferOutput<typeof CancelTriggerResultSchema>;
|
|
47
47
|
declare const ModifyTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
48
48
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
49
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "
|
|
49
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused">]>;
|
|
50
50
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
51
51
|
}, undefined>, v.TransformAction<{
|
|
52
52
|
triggerId: string;
|
|
53
|
-
status: "unspecified" | "
|
|
53
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
54
54
|
tsNs: bigint;
|
|
55
55
|
}, {
|
|
56
56
|
ts: number;
|
|
57
57
|
tsNs: string;
|
|
58
58
|
triggerId: string;
|
|
59
|
-
status: "unspecified" | "
|
|
59
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
60
60
|
}>]>;
|
|
61
61
|
type ModifyTriggerResult = v.InferOutput<typeof ModifyTriggerResultSchema>;
|
|
62
62
|
declare const PauseTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
63
63
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
64
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "
|
|
64
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused">]>;
|
|
65
65
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
66
66
|
}, undefined>, v.TransformAction<{
|
|
67
67
|
triggerId: string;
|
|
68
|
-
status: "unspecified" | "
|
|
68
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
69
69
|
tsNs: bigint;
|
|
70
70
|
}, {
|
|
71
71
|
ts: number;
|
|
72
72
|
tsNs: string;
|
|
73
73
|
triggerId: string;
|
|
74
|
-
status: "unspecified" | "
|
|
74
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
75
75
|
}>]>;
|
|
76
76
|
type PauseTriggerResult = v.InferOutput<typeof PauseTriggerResultSchema>;
|
|
77
77
|
declare const ResumeTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
78
78
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
79
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "
|
|
79
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused">]>;
|
|
80
80
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
81
81
|
}, undefined>, v.TransformAction<{
|
|
82
82
|
triggerId: string;
|
|
83
|
-
status: "unspecified" | "
|
|
83
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
84
84
|
tsNs: bigint;
|
|
85
85
|
}, {
|
|
86
86
|
ts: number;
|
|
87
87
|
tsNs: string;
|
|
88
88
|
triggerId: string;
|
|
89
|
-
status: "unspecified" | "
|
|
89
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
90
90
|
}>]>;
|
|
91
91
|
type ResumeTriggerResult = v.InferOutput<typeof ResumeTriggerResultSchema>;
|
|
92
92
|
type StopDetailsOutput = {
|
|
@@ -528,7 +528,7 @@ declare function createTriggerSchema(scales: SdkScales): v.SchemaWithPipe<readon
|
|
|
528
528
|
triggerId: string;
|
|
529
529
|
subaccountId: string;
|
|
530
530
|
symbolId: number;
|
|
531
|
-
status: "unspecified" | "
|
|
531
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
532
532
|
parentOrderId: string | undefined;
|
|
533
533
|
qty: string;
|
|
534
534
|
feeAsset: "unspecified" | "quote" | "base";
|
|
@@ -669,7 +669,7 @@ declare function createTriggerSchema(scales: SdkScales): v.SchemaWithPipe<readon
|
|
|
669
669
|
triggerId: string;
|
|
670
670
|
subaccountId: string;
|
|
671
671
|
symbolId: number;
|
|
672
|
-
status: "unspecified" | "
|
|
672
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
673
673
|
parentOrderId: string | undefined;
|
|
674
674
|
qty: string;
|
|
675
675
|
feeAsset: "unspecified" | "quote" | "base";
|
|
@@ -810,7 +810,7 @@ declare function createTriggerSchema(scales: SdkScales): v.SchemaWithPipe<readon
|
|
|
810
810
|
triggerId: string;
|
|
811
811
|
subaccountId: string;
|
|
812
812
|
symbolId: number;
|
|
813
|
-
status: "unspecified" | "
|
|
813
|
+
status: "unspecified" | "failed" | "cancelled" | "created" | "completed" | "armed" | "running" | "paused";
|
|
814
814
|
parentOrderId: string | undefined;
|
|
815
815
|
qty: string;
|
|
816
816
|
feeAsset: "unspecified" | "quote" | "base";
|
|
@@ -994,7 +994,7 @@ declare function createTriggerEventSchema(scales: SdkScales): v.SchemaWithPipe<r
|
|
|
994
994
|
subaccountId: string;
|
|
995
995
|
symbolId: number;
|
|
996
996
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
997
|
-
eventType: "unspecified" | "
|
|
997
|
+
eventType: "unspecified" | "failed" | "updated" | "fired" | "canceled";
|
|
998
998
|
ts: number;
|
|
999
999
|
childSeq: number;
|
|
1000
1000
|
childOrderId: string | undefined;
|
|
@@ -1006,7 +1006,7 @@ declare function createTriggerEventSchema(scales: SdkScales): v.SchemaWithPipe<r
|
|
|
1006
1006
|
subaccountId: string;
|
|
1007
1007
|
symbolId: number;
|
|
1008
1008
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
1009
|
-
eventType: "unspecified" | "
|
|
1009
|
+
eventType: "unspecified" | "failed" | "updated" | "fired" | "canceled";
|
|
1010
1010
|
ts: number;
|
|
1011
1011
|
childSeq: number;
|
|
1012
1012
|
childOrderId: string | undefined;
|
|
@@ -1018,7 +1018,7 @@ declare function createTriggerEventSchema(scales: SdkScales): v.SchemaWithPipe<r
|
|
|
1018
1018
|
subaccountId: string;
|
|
1019
1019
|
symbolId: number;
|
|
1020
1020
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
1021
|
-
eventType: "unspecified" | "
|
|
1021
|
+
eventType: "unspecified" | "failed" | "updated" | "fired" | "canceled";
|
|
1022
1022
|
ts: number;
|
|
1023
1023
|
childSeq: number;
|
|
1024
1024
|
childOrderId: string | undefined;
|
package/package.json
CHANGED