@polyester/sdk 0.35.0-devnet-20261111140253 → 0.35.0-devnet-20261111161451
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 -2
- package/dist/client.d.ts +6 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +2 -2
- package/dist/gen/ai/v1/assistant_pb.js +2 -2
- package/dist/gen/index.d.ts +11 -11
- package/dist/gen/index.js +9 -9
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/services/api-keys/api-keys.d.ts +16 -1
- package/dist/services/api-keys/api-keys.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.js +25 -1
- package/dist/services/api-keys/api-keys.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +112 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +26 -2
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.types.d.ts +2 -2
- package/dist/services/api-keys/index.d.ts +2 -2
- package/dist/services/assistant/assistant-events.schemas.d.ts +4618 -0
- package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -0
- package/dist/services/assistant/assistant-events.schemas.js +485 -0
- package/dist/services/assistant/assistant-events.schemas.js.map +1 -0
- package/dist/services/assistant/assistant.codecs.d.ts +24 -0
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -0
- package/dist/services/assistant/assistant.codecs.js +88 -0
- package/dist/services/assistant/assistant.codecs.js.map +1 -0
- package/dist/services/assistant/assistant.d.ts +76 -0
- package/dist/services/assistant/assistant.d.ts.map +1 -0
- package/dist/services/assistant/assistant.js +133 -0
- package/dist/services/assistant/assistant.js.map +1 -0
- package/dist/services/assistant/assistant.schemas.d.ts +184 -0
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -0
- package/dist/services/assistant/assistant.schemas.js +135 -0
- package/dist/services/assistant/assistant.schemas.js.map +1 -0
- package/dist/services/assistant/assistant.types.d.ts +4 -0
- package/dist/services/assistant/service.d.ts +8 -0
- package/dist/services/assistant/service.d.ts.map +1 -0
- package/dist/services/assistant/service.js +9 -0
- package/dist/services/assistant/service.js.map +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +22 -22
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/balances/balances.schemas.d.ts +3 -3
- package/dist/services/candles/candles.js +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/candles/candles.schemas.js +5 -2
- package/dist/services/candles/candles.schemas.js.map +1 -1
- package/dist/services/changelog/changelog.schemas.d.ts +17 -17
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +3 -3
- package/dist/services/heatmap/heatmap.schemas.d.ts +13 -13
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +148 -148
- package/dist/services/market-data/market-data.js +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +4 -4
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +27 -27
- package/dist/services/orders/orders-input.schemas.d.ts +3 -3
- package/dist/services/orders/orders-input.schemas.js +1 -1
- package/dist/services/orders/orders-modify.schemas.js +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +11 -11
- package/dist/services/orders/orders-output.schemas.js +3 -3
- package/dist/services/orders/orders-risk.schemas.js +1 -1
- package/dist/services/orders/orders.codecs.js +1 -1
- package/dist/services/orders/orders.js +3 -3
- package/dist/services/price-alerts/price-alerts.codecs.d.ts +20 -0
- package/dist/services/price-alerts/price-alerts.codecs.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.codecs.js +66 -0
- package/dist/services/price-alerts/price-alerts.codecs.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.d.ts +38 -0
- package/dist/services/price-alerts/price-alerts.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.js +60 -0
- package/dist/services/price-alerts/price-alerts.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.schemas.d.ts +309 -0
- package/dist/services/price-alerts/price-alerts.schemas.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.schemas.js +130 -0
- package/dist/services/price-alerts/price-alerts.schemas.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.types.d.ts +3 -0
- package/dist/services/price-alerts/service.d.ts +8 -0
- package/dist/services/price-alerts/service.d.ts.map +1 -0
- package/dist/services/price-alerts/service.js +9 -0
- package/dist/services/price-alerts/service.js.map +1 -0
- package/dist/services/social-verification/social-verification.schemas.d.ts +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +3 -3
- package/dist/services/system/service.d.ts +8 -0
- package/dist/services/system/service.d.ts.map +1 -0
- package/dist/services/system/service.js +9 -0
- package/dist/services/system/service.js.map +1 -0
- package/dist/services/system/system.d.ts +25 -0
- package/dist/services/system/system.d.ts.map +1 -0
- package/dist/services/system/system.js +24 -0
- package/dist/services/system/system.js.map +1 -0
- package/dist/services/trades/trades.js +1 -1
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/trades/trades.schemas.js +1 -1
- package/dist/services/transfers/transfers.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-child-order.schemas.js +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/trigger-input.schemas.js +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +61 -61
- package/dist/services/triggers/triggers.codecs.js +1 -1
- package/dist/services/triggers/triggers.js +2 -2
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +1 -0
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +18 -10
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +2 -0
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/alerts.js +15 -0
- package/dist/shared/error-details/alerts.js.map +1 -0
- package/dist/shared/error-details/assistant.js +15 -0
- package/dist/shared/error-details/assistant.js.map +1 -0
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +11 -5
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { formatId } from "../../utils/base58-id.js";
|
|
2
|
+
import { tsObjToMs } from "../../utils/time.js";
|
|
3
|
+
import { idInputSchema, optionalSubaccountIdInputSchema } from "../../shared/schemas.js";
|
|
4
|
+
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
5
|
+
import { ASSISTANT_APPROVAL_DECISION_VALUES, ApprovalDecisionCodec, AssistantKeyStateCodec, MemoryKindCodec, MessageRoleCodec } from "./assistant.codecs.js";
|
|
6
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
7
|
+
import * as v from "valibot";
|
|
8
|
+
//#region src/services/assistant/assistant.schemas.ts
|
|
9
|
+
const IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));
|
|
10
|
+
function pageInputEntries(maxLimit) {
|
|
11
|
+
return {
|
|
12
|
+
/** Page size; omit for the server default. */
|
|
13
|
+
limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),
|
|
14
|
+
/** The previous page's `nextPageToken`. */
|
|
15
|
+
pageToken: v.optional(v.pipe(v.string(), v.trim()))
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const DestinationInputSchema = v.strictObject({
|
|
19
|
+
/** The client's id for the place, e.g. `"page-subaccounts"`: lowercase letters, digits and hyphens. */
|
|
20
|
+
id: v.pipe(v.string(), v.regex(/^[a-z0-9-]{1,64}$/, "destination id must be 1-64 of a-z, 0-9, -")),
|
|
21
|
+
/** Its name as the client shows it, 1 to 80 characters. */
|
|
22
|
+
title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),
|
|
23
|
+
/** What the user does there, at most 200 characters. */
|
|
24
|
+
description: v.optional(v.pipe(v.string(), v.maxLength(200)), "")
|
|
25
|
+
});
|
|
26
|
+
const SendAssistantMessageInputSchema = v.pipe(v.strictObject({
|
|
27
|
+
/** Conversation to continue; omit to start a new one. */
|
|
28
|
+
conversationId: v.optional(idInputSchema("conversationId")),
|
|
29
|
+
/** Message text, plain text or Markdown, 1 to 16000 characters. */
|
|
30
|
+
text: v.pipe(v.string(), v.minLength(1), v.maxLength(16e3)),
|
|
31
|
+
/** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */
|
|
32
|
+
idempotencyKey: IdempotencyKeySchema,
|
|
33
|
+
/**
|
|
34
|
+
* Trading account the run reads and acts on. Omit to answer without account data: the
|
|
35
|
+
* run then has no account tools.
|
|
36
|
+
*/
|
|
37
|
+
subaccountId: optionalSubaccountIdInputSchema(),
|
|
38
|
+
/** Places in the client the run may suggest, at most 100, each id once. */
|
|
39
|
+
destinations: v.optional(v.pipe(v.array(DestinationInputSchema), v.maxLength(100, "At most 100 destinations are allowed."), v.check((items) => new Set(items.map((d) => d.id)).size === items.length, "Destination ids must be distinct.")))
|
|
40
|
+
}));
|
|
41
|
+
const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema("runId") });
|
|
42
|
+
const WatchAssistantRunInputSchema = v.pipe(v.strictObject({
|
|
43
|
+
runId: idInputSchema("runId"),
|
|
44
|
+
/** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */
|
|
45
|
+
afterSeq: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)), 0)
|
|
46
|
+
}), v.transform(({ runId, afterSeq }) => ({
|
|
47
|
+
runId,
|
|
48
|
+
afterSeq: BigInt(afterSeq)
|
|
49
|
+
})));
|
|
50
|
+
const DecideAssistantApprovalInputSchema = v.pipe(v.strictObject({
|
|
51
|
+
approvalId: idInputSchema("approvalId"),
|
|
52
|
+
decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES)
|
|
53
|
+
}), v.transform(({ approvalId, decision }) => ({
|
|
54
|
+
approvalId,
|
|
55
|
+
decision: ApprovalDecisionCodec.inputToProto[decision]
|
|
56
|
+
})));
|
|
57
|
+
const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));
|
|
58
|
+
const ListAssistantMessagesInputSchema = v.strictObject({
|
|
59
|
+
conversationId: idInputSchema("conversationId"),
|
|
60
|
+
...pageInputEntries(200)
|
|
61
|
+
});
|
|
62
|
+
const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));
|
|
63
|
+
const DeleteAssistantMemoryInputSchema = v.strictObject({ memoryId: idInputSchema("memoryId") });
|
|
64
|
+
const PrepareAssistantKeysInputSchema = v.pipe(v.strictObject({
|
|
65
|
+
/** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */
|
|
66
|
+
accounts: v.pipe(v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })), v.minLength(1, "At least one account is required."), v.maxLength(64, "At most 64 accounts are allowed.")) }), v.check(({ accounts }) => new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length, "Each account may be named only once."));
|
|
67
|
+
const CompleteAssistantKeysInputSchema = v.strictObject({ setupId: idInputSchema("setupId") });
|
|
68
|
+
function optionalId(id) {
|
|
69
|
+
return id ? formatId(id) : void 0;
|
|
70
|
+
}
|
|
71
|
+
function formatConversation(c) {
|
|
72
|
+
return {
|
|
73
|
+
conversationId: formatId(c.conversationId),
|
|
74
|
+
/** Empty until a title is available. */
|
|
75
|
+
title: c.title,
|
|
76
|
+
createdAt: tsObjToMs(c.createdAt),
|
|
77
|
+
updatedAt: tsObjToMs(c.updatedAt)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function formatMessage(m) {
|
|
81
|
+
return {
|
|
82
|
+
messageId: formatId(m.messageId),
|
|
83
|
+
role: enumLabel(MessageRoleCodec.protoToOutput, m.role),
|
|
84
|
+
/** Markdown. For an assistant message, its run's final text. */
|
|
85
|
+
text: m.text,
|
|
86
|
+
createdAt: tsObjToMs(m.createdAt),
|
|
87
|
+
/** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */
|
|
88
|
+
runId: formatId(m.runId)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function formatMemory(m) {
|
|
92
|
+
return {
|
|
93
|
+
memoryId: formatId(m.memoryId),
|
|
94
|
+
text: m.text,
|
|
95
|
+
createdAt: tsObjToMs(m.createdAt),
|
|
96
|
+
/** Omitted when the conversation it was learned in is unknown. */
|
|
97
|
+
conversationId: optionalId(m.conversationId),
|
|
98
|
+
kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function formatAssistantKey(k) {
|
|
102
|
+
return {
|
|
103
|
+
/** Omitted for the main account. */
|
|
104
|
+
subaccountId: optionalId(k.subaccountId),
|
|
105
|
+
keyId: k.keyId,
|
|
106
|
+
publicKeyEd25519: k.publicKeyEd25519,
|
|
107
|
+
publicKeyHex: bytesToHex(k.publicKeyEd25519),
|
|
108
|
+
state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function formatPreparedAssistantKey(k) {
|
|
112
|
+
return {
|
|
113
|
+
/** Omitted for the main account. */
|
|
114
|
+
subaccountId: optionalId(k.subaccountId),
|
|
115
|
+
publicKeyEd25519: k.publicKeyEd25519,
|
|
116
|
+
publicKeyHex: bytesToHex(k.publicKeyEd25519),
|
|
117
|
+
/** Pass unchanged to `apiKeys.setAssistantKeys`. */
|
|
118
|
+
registrationProof: k.registrationProof,
|
|
119
|
+
/** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */
|
|
120
|
+
registrationDeadline: tsObjToMs(k.registrationDeadline)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function formatPrepareAssistantKeysResult(r) {
|
|
124
|
+
return {
|
|
125
|
+
setupId: formatId(r.setupId),
|
|
126
|
+
/** One key per requested account, in request order. */
|
|
127
|
+
keys: r.keys.map(formatPreparedAssistantKey),
|
|
128
|
+
/** Epoch ms after which the keys can no longer be registered. */
|
|
129
|
+
expiresAt: tsObjToMs(r.expiresAt)
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey };
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=assistant.schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /** Message text, plain text or Markdown, 1 to 16000 characters. */\n text: v.pipe(v.string(), v.minLength(1), v.maxLength(16_000)),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit to answer without account data: the\n * run then has no account tools.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n }),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n };\n}\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n };\n}\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n"],"mappings":"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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AssistantApprovalPreview, AssistantOrderPreview, AssistantRunEvent, AssistantView } from "./assistant-events.schemas.js";
|
|
2
|
+
import { AssistantApprovalDecision, AssistantApprovalStatus, AssistantFailureCategory, AssistantKeyState, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./assistant.codecs.js";
|
|
3
|
+
import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, WatchAssistantRunInput } from "./assistant.schemas.js";
|
|
4
|
+
export type { AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, WatchAssistantRunInput };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AssistantService } from "./assistant.js";
|
|
2
|
+
import { PolyesterCore } from "../../core-client.js";
|
|
3
|
+
//#region src/services/assistant/service.d.ts
|
|
4
|
+
/** Returns the client's AssistantService, creating it on first use. */
|
|
5
|
+
declare const assistantService: (client: PolyesterCore) => AssistantService;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { assistantService };
|
|
8
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","names":[],"sources":["../../../src/services/assistant/service.ts"],"mappings":";;;;cAIa,mBAAgB,QAAhB,kBAAgB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineService } from "../../core-client.js";
|
|
2
|
+
import { AssistantService } from "./assistant.js";
|
|
3
|
+
//#region src/services/assistant/service.ts
|
|
4
|
+
/** Returns the client's AssistantService, creating it on first use. */
|
|
5
|
+
const assistantService = defineService((context) => new AssistantService(context.transports, context.scales));
|
|
6
|
+
//#endregion
|
|
7
|
+
export { assistantService };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","names":[],"sources":["../../../src/services/assistant/service.ts"],"sourcesContent":["import { defineService } from \"../../core-client.js\";\nimport { AssistantService } from \"./assistant.js\";\n\n/** Returns the client's AssistantService, creating it on first use. */\nexport const assistantService = defineService(\n (context) => new AssistantService(context.transports, context.scales),\n);\n"],"mappings":";;;;AAIA,MAAa,mBAAmB,eAC3B,YAAY,IAAI,iBAAiB,QAAQ,YAAY,QAAQ,MAAM,CACxE"}
|
|
@@ -500,7 +500,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
500
500
|
readonly hi: v.BigintSchema<undefined>;
|
|
501
501
|
readonly lo: v.BigintSchema<undefined>;
|
|
502
502
|
}, undefined>, undefined>;
|
|
503
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
503
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted">]>;
|
|
504
504
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
505
505
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
506
506
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -524,7 +524,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
524
524
|
hi: bigint;
|
|
525
525
|
lo: bigint;
|
|
526
526
|
} | undefined;
|
|
527
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
527
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
528
528
|
reason: AutoWithdrawStepReason | null;
|
|
529
529
|
intentId: string;
|
|
530
530
|
txHash: string;
|
|
@@ -538,7 +538,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
538
538
|
txHash: string | null;
|
|
539
539
|
assetId: number;
|
|
540
540
|
destinationAddress: string;
|
|
541
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
541
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
542
542
|
reason: AutoWithdrawStepReason | null;
|
|
543
543
|
}>]>;
|
|
544
544
|
/**
|
|
@@ -559,7 +559,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
559
559
|
seconds: bigint;
|
|
560
560
|
nanos: number;
|
|
561
561
|
}, number>]>;
|
|
562
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
562
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped">]>;
|
|
563
563
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
|
|
564
564
|
readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
565
565
|
readonly assetId: v.NumberSchema<undefined>;
|
|
@@ -581,7 +581,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
581
581
|
readonly hi: v.BigintSchema<undefined>;
|
|
582
582
|
readonly lo: v.BigintSchema<undefined>;
|
|
583
583
|
}, undefined>, undefined>;
|
|
584
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
584
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted">]>;
|
|
585
585
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
586
586
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
587
587
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -605,7 +605,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
605
605
|
hi: bigint;
|
|
606
606
|
lo: bigint;
|
|
607
607
|
} | undefined;
|
|
608
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
608
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
609
609
|
reason: AutoWithdrawStepReason | null;
|
|
610
610
|
intentId: string;
|
|
611
611
|
txHash: string;
|
|
@@ -619,7 +619,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
619
619
|
txHash: string | null;
|
|
620
620
|
assetId: number;
|
|
621
621
|
destinationAddress: string;
|
|
622
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
622
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
623
623
|
reason: AutoWithdrawStepReason | null;
|
|
624
624
|
}>]>, undefined>;
|
|
625
625
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -640,7 +640,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
640
640
|
runSeq: string;
|
|
641
641
|
ruleVersion: number;
|
|
642
642
|
scheduledFor: number;
|
|
643
|
-
state: "unspecified" | "failed" | "
|
|
643
|
+
state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
|
|
644
644
|
reason: AutoWithdrawRunReason | null;
|
|
645
645
|
steps: {
|
|
646
646
|
destinationChainId: number;
|
|
@@ -652,7 +652,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
652
652
|
txHash: string | null;
|
|
653
653
|
assetId: number;
|
|
654
654
|
destinationAddress: string;
|
|
655
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
655
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
656
656
|
reason: AutoWithdrawStepReason | null;
|
|
657
657
|
}[];
|
|
658
658
|
createdAt: number;
|
|
@@ -662,7 +662,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
662
662
|
runSeq: string;
|
|
663
663
|
ruleVersion: number;
|
|
664
664
|
scheduledFor: number;
|
|
665
|
-
state: "unspecified" | "failed" | "
|
|
665
|
+
state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
|
|
666
666
|
reason: AutoWithdrawRunReason | null;
|
|
667
667
|
steps: {
|
|
668
668
|
destinationChainId: number;
|
|
@@ -674,7 +674,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
674
674
|
txHash: string | null;
|
|
675
675
|
assetId: number;
|
|
676
676
|
destinationAddress: string;
|
|
677
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
677
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
678
678
|
reason: AutoWithdrawStepReason | null;
|
|
679
679
|
}[];
|
|
680
680
|
createdAt: number;
|
|
@@ -692,7 +692,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
692
692
|
seconds: bigint;
|
|
693
693
|
nanos: number;
|
|
694
694
|
}, number>]>;
|
|
695
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
695
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped">]>;
|
|
696
696
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
|
|
697
697
|
readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
698
698
|
readonly assetId: v.NumberSchema<undefined>;
|
|
@@ -714,7 +714,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
714
714
|
readonly hi: v.BigintSchema<undefined>;
|
|
715
715
|
readonly lo: v.BigintSchema<undefined>;
|
|
716
716
|
}, undefined>, undefined>;
|
|
717
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
717
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted">]>;
|
|
718
718
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
719
719
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
720
720
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -738,7 +738,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
738
738
|
hi: bigint;
|
|
739
739
|
lo: bigint;
|
|
740
740
|
} | undefined;
|
|
741
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
741
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
742
742
|
reason: AutoWithdrawStepReason | null;
|
|
743
743
|
intentId: string;
|
|
744
744
|
txHash: string;
|
|
@@ -752,7 +752,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
752
752
|
txHash: string | null;
|
|
753
753
|
assetId: number;
|
|
754
754
|
destinationAddress: string;
|
|
755
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
755
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
756
756
|
reason: AutoWithdrawStepReason | null;
|
|
757
757
|
}>]>, undefined>;
|
|
758
758
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -773,7 +773,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
773
773
|
runSeq: string;
|
|
774
774
|
ruleVersion: number;
|
|
775
775
|
scheduledFor: number;
|
|
776
|
-
state: "unspecified" | "failed" | "
|
|
776
|
+
state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
|
|
777
777
|
reason: AutoWithdrawRunReason | null;
|
|
778
778
|
steps: {
|
|
779
779
|
destinationChainId: number;
|
|
@@ -785,7 +785,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
785
785
|
txHash: string | null;
|
|
786
786
|
assetId: number;
|
|
787
787
|
destinationAddress: string;
|
|
788
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
788
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
789
789
|
reason: AutoWithdrawStepReason | null;
|
|
790
790
|
}[];
|
|
791
791
|
createdAt: number;
|
|
@@ -795,7 +795,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
795
795
|
runSeq: string;
|
|
796
796
|
ruleVersion: number;
|
|
797
797
|
scheduledFor: number;
|
|
798
|
-
state: "unspecified" | "failed" | "
|
|
798
|
+
state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
|
|
799
799
|
reason: AutoWithdrawRunReason | null;
|
|
800
800
|
steps: {
|
|
801
801
|
destinationChainId: number;
|
|
@@ -807,7 +807,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
807
807
|
txHash: string | null;
|
|
808
808
|
assetId: number;
|
|
809
809
|
destinationAddress: string;
|
|
810
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
810
|
+
state: "unspecified" | "failed" | "completed" | "pending" | "skipped" | "submitting" | "submitted";
|
|
811
811
|
reason: AutoWithdrawStepReason | null;
|
|
812
812
|
}[];
|
|
813
813
|
createdAt: number;
|
|
@@ -923,7 +923,7 @@ declare const AutoWithdrawPreviewAssetSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
923
923
|
*/
|
|
924
924
|
type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;
|
|
925
925
|
declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
926
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
926
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule">]>;
|
|
927
927
|
readonly nextRunAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
928
928
|
readonly seconds: v.BigintSchema<undefined>;
|
|
929
929
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -1052,7 +1052,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
1052
1052
|
nanos: number;
|
|
1053
1053
|
}, number>]>;
|
|
1054
1054
|
}, undefined>, v.TransformAction<{
|
|
1055
|
-
status: "unspecified" | "
|
|
1055
|
+
status: "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule";
|
|
1056
1056
|
nextRunAt?: number | undefined;
|
|
1057
1057
|
ruleVersion: number;
|
|
1058
1058
|
pause?: {
|
|
@@ -1088,7 +1088,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
1088
1088
|
pausedAt: number;
|
|
1089
1089
|
} | null;
|
|
1090
1090
|
minUsdValue: string | null;
|
|
1091
|
-
status: "unspecified" | "
|
|
1091
|
+
status: "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule";
|
|
1092
1092
|
ruleVersion: number;
|
|
1093
1093
|
assets: {
|
|
1094
1094
|
assetId: number;
|
|
@@ -5,8 +5,8 @@ import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
|
5
5
|
import { decimalInputToScaled, scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
6
6
|
import { PositiveUint32InputSchema } from "../shared.js";
|
|
7
7
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
8
|
-
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
9
8
|
import { fromU128, toU128 } from "../../utils/u128.js";
|
|
9
|
+
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
10
10
|
import { AUTO_WITHDRAW_WEEKDAY_VALUES, AutoWithdrawCadenceCodec, AutoWithdrawPreviewStatusCodec, AutoWithdrawRunStateCodec, AutoWithdrawStepStateCodec, AutoWithdrawWeekdayCodec } from "./auto-withdraw.codecs.js";
|
|
11
11
|
import * as v from "valibot";
|
|
12
12
|
//#region src/services/auto-withdraw/auto-withdraw.schemas.ts
|
|
@@ -3,8 +3,8 @@ import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
|
3
3
|
import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
4
4
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
5
5
|
import { accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
6
|
-
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
7
6
|
import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance } from "./balances.schemas.js";
|
|
7
|
+
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
8
8
|
import { createClient } from "@connectrpc/connect";
|
|
9
9
|
//#region src/services/balances/balances.ts
|
|
10
10
|
/**
|
|
@@ -57,7 +57,7 @@ type EquityGroupBy = v.InferOutput<typeof EquityGroupBySchema>;
|
|
|
57
57
|
declare const BalanceHistoryInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
58
58
|
readonly range: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1d", "7d", "30d", "90d", "180d", "365d"], undefined>, v.TransformAction<"1d" | "7d" | "30d" | "90d" | "180d" | "365d", BalanceRange$1.DAY_1 | BalanceRange$1.DAY_7 | BalanceRange$1.DAY_30 | BalanceRange$1.DAY_90 | BalanceRange$1.DAY_180 | BalanceRange$1.DAY_365>]>;
|
|
59
59
|
readonly ledger: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, 0>;
|
|
60
|
-
readonly accountCodes: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["funding", "trading"], undefined>, v.TransformAction<"
|
|
60
|
+
readonly accountCodes: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["funding", "trading"], undefined>, v.TransformAction<"funding" | "trading", AccountCode.FUNDING | AccountCode.TRADING>]>, undefined>, readonly []>;
|
|
61
61
|
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
62
62
|
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
63
63
|
}, undefined>], undefined>, undefined>;
|
|
@@ -111,14 +111,14 @@ declare function createBalanceHistoryResponseSchema(): v.SchemaWithPipe<readonly
|
|
|
111
111
|
points: number;
|
|
112
112
|
series: {
|
|
113
113
|
assetId: number;
|
|
114
|
-
accountCode: "unspecified" | "
|
|
114
|
+
accountCode: "unspecified" | "funding" | "trading";
|
|
115
115
|
balance: string[];
|
|
116
116
|
}[];
|
|
117
117
|
}>]>;
|
|
118
118
|
type BalanceHistoryResponse = v.InferOutput<ReturnType<typeof createBalanceHistoryResponseSchema>>;
|
|
119
119
|
declare const EquityHistoryInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
120
120
|
readonly range: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1d", "7d", "30d", "90d", "180d", "365d"], undefined>, v.TransformAction<"1d" | "7d" | "30d" | "90d" | "180d" | "365d", BalanceRange$1.DAY_1 | BalanceRange$1.DAY_7 | BalanceRange$1.DAY_30 | BalanceRange$1.DAY_90 | BalanceRange$1.DAY_180 | BalanceRange$1.DAY_365>]>;
|
|
121
|
-
readonly accountCodes: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["funding", "trading"], undefined>, v.TransformAction<"
|
|
121
|
+
readonly accountCodes: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["funding", "trading"], undefined>, v.TransformAction<"funding" | "trading", AccountCode.FUNDING | AccountCode.TRADING>]>, undefined>, readonly []>;
|
|
122
122
|
readonly groupBy: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["account", "asset"], undefined>, "account">, v.TransformAction<"account" | "asset", EquityGroupBy$1.GROUP_BY_ACCOUNT | EquityGroupBy$1.GROUP_BY_ASSET>]>;
|
|
123
123
|
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
124
124
|
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parse } from "../../shared/validation.js";
|
|
2
2
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
3
|
import { SymbolIdInputSchema } from "../shared.js";
|
|
4
|
-
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
5
4
|
import { CandlePointSchema, MarketDataService } from "../../gen/marketdata/v1/marketdata_pb.js";
|
|
6
5
|
import { TimeframeCodec } from "./candles.codecs.js";
|
|
7
6
|
import { ListCandlesInputSchema, TimeframeSchema, createCandleColumnarIntSchema, createCandleColumnarSchema, formatCandleRow } from "./candles.schemas.js";
|
|
7
|
+
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
8
8
|
import { createClient } from "@connectrpc/connect";
|
|
9
9
|
import * as v from "valibot";
|
|
10
10
|
//#region src/services/candles/candles.ts
|
|
@@ -11,7 +11,7 @@ type TimestampInit = {
|
|
|
11
11
|
};
|
|
12
12
|
declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
13
13
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
14
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "
|
|
14
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">>]>;
|
|
15
15
|
readonly tsSec: v.BigintSchema<undefined>;
|
|
16
16
|
readonly open: v.BigintSchema<undefined>;
|
|
17
17
|
readonly high: v.BigintSchema<undefined>;
|
|
@@ -22,7 +22,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
22
22
|
readonly isClosed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
23
23
|
}, undefined>, v.TransformAction<{
|
|
24
24
|
symbolId: number;
|
|
25
|
-
timeframe: DecodedEnum<"1d" | "
|
|
25
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">;
|
|
26
26
|
tsSec: bigint;
|
|
27
27
|
open: bigint;
|
|
28
28
|
high: bigint;
|
|
@@ -33,7 +33,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
33
33
|
isClosed: boolean;
|
|
34
34
|
}, {
|
|
35
35
|
symbolId: number;
|
|
36
|
-
timeframe: DecodedEnum<"1d" | "
|
|
36
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">;
|
|
37
37
|
time: number;
|
|
38
38
|
open: string;
|
|
39
39
|
high: string;
|
|
@@ -46,7 +46,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
46
46
|
declare const createCandleRowIntSchema: typeof createCandleRowSchema;
|
|
47
47
|
declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
48
48
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
49
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "
|
|
49
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">>]>;
|
|
50
50
|
readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
51
51
|
readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
52
52
|
readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
@@ -63,7 +63,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
63
63
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
64
64
|
}, undefined>, v.TransformAction<{
|
|
65
65
|
symbolId: number;
|
|
66
|
-
timeframe: DecodedEnum<"1d" | "
|
|
66
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">;
|
|
67
67
|
tsSec: bigint[];
|
|
68
68
|
open: bigint[];
|
|
69
69
|
high: bigint[];
|
|
@@ -80,7 +80,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
80
80
|
nextPageToken: string;
|
|
81
81
|
}, {
|
|
82
82
|
symbolId: number;
|
|
83
|
-
timeframe: DecodedEnum<"1d" | "
|
|
83
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">;
|
|
84
84
|
time: number[];
|
|
85
85
|
open: string[];
|
|
86
86
|
high: string[];
|
|
@@ -100,7 +100,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
100
100
|
}>]>;
|
|
101
101
|
declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
102
102
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
103
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "
|
|
103
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">>]>;
|
|
104
104
|
readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
105
105
|
readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
106
106
|
readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
@@ -117,7 +117,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
117
117
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
118
118
|
}, undefined>, v.TransformAction<{
|
|
119
119
|
symbolId: number;
|
|
120
|
-
timeframe: DecodedEnum<"1d" | "
|
|
120
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">;
|
|
121
121
|
tsSec: bigint[];
|
|
122
122
|
open: bigint[];
|
|
123
123
|
high: bigint[];
|
|
@@ -134,7 +134,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
134
134
|
nextPageToken: string;
|
|
135
135
|
}, {
|
|
136
136
|
symbolId: number;
|
|
137
|
-
timeframe: DecodedEnum<"1d" | "
|
|
137
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo">;
|
|
138
138
|
tsSec: number[];
|
|
139
139
|
open: string[];
|
|
140
140
|
high: string[];
|
|
@@ -158,7 +158,7 @@ type CandleColumnar = v.InferOutput<ReturnType<typeof createCandleColumnarSchema
|
|
|
158
158
|
type CandleColumnarInt = v.InferOutput<ReturnType<typeof createCandleColumnarIntSchema>>;
|
|
159
159
|
declare function createListCandlesInputSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
160
160
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
161
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "
|
|
161
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "3m" | "15m" | "30m" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1mo", Timeframe$1.SEC_1 | Timeframe$1.MIN_1 | Timeframe$1.MIN_3 | Timeframe$1.MIN_5 | Timeframe$1.MIN_15 | Timeframe$1.MIN_30 | Timeframe$1.HOUR_1 | Timeframe$1.HOUR_2 | Timeframe$1.HOUR_4 | Timeframe$1.HOUR_6 | Timeframe$1.HOUR_8 | Timeframe$1.HOUR_12 | Timeframe$1.DAY_1 | Timeframe$1.DAY_3 | Timeframe$1.WEEK_1 | Timeframe$1.MONTH_1>]>;
|
|
162
162
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 10000, undefined>]>, undefined>;
|
|
163
163
|
readonly includeIncomplete: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
164
164
|
readonly includeReference: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
@@ -18,7 +18,7 @@ function timestampFromTsSec(tsSec) {
|
|
|
18
18
|
nanos: 0
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
v.object({
|
|
21
|
+
const CandleRowRawSchema = v.object({
|
|
22
22
|
symbolId: v.number(),
|
|
23
23
|
timeframe: v.pipe(v.number(), v.transform((v) => timeframeFromProto(v))),
|
|
24
24
|
tsSec: v.bigint(),
|
|
@@ -45,6 +45,9 @@ function toCandleRow(scales, data) {
|
|
|
45
45
|
isClosed: data.isClosed
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
+
function createCandleRowSchema(scales) {
|
|
49
|
+
return v.pipe(CandleRowRawSchema, v.transform((data) => toCandleRow(scales, data)));
|
|
50
|
+
}
|
|
48
51
|
/**
|
|
49
52
|
* Formats a protobuf-decoded candle point like {@link createCandleRowSchema} without
|
|
50
53
|
* re-validating it. `timeframe` is the proto enum value of the series.
|
|
@@ -171,6 +174,6 @@ const ListCandlesInputSchema = v.pipe(v.object({
|
|
|
171
174
|
pageToken: d.pageToken
|
|
172
175
|
})));
|
|
173
176
|
//#endregion
|
|
174
|
-
export { ListCandlesInputSchema, TimeframeSchema, createCandleColumnarIntSchema, createCandleColumnarSchema, formatCandleRow };
|
|
177
|
+
export { ListCandlesInputSchema, TimeframeSchema, createCandleColumnarIntSchema, createCandleColumnarSchema, createCandleRowSchema, formatCandleRow };
|
|
175
178
|
|
|
176
179
|
//# sourceMappingURL=candles.schemas.js.map
|