@polyester/sdk 0.36.0-devnet-20261112144059 → 0.36.0-devnet-20261112202000
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 +3 -1
- package/dist/browser-core.js +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +1 -1
- package/dist/gen/auth/v1/address_book_pb.d.ts +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +1 -1
- package/dist/gen/auth/v1/mfa_pb.d.ts +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
- package/dist/gen/chain/analytics/v1/analytics_read_pb.d.ts +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +1 -1
- package/dist/gen/chain/zipper/v1/reason_pb.d.ts +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +1 -1
- package/dist/gen/fees/v1/fees_pb.d.ts +1 -1
- package/dist/gen/index.js +20 -20
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +1 -1
- package/dist/gen/polyester/type/v1/u128_pb.d.ts +1 -1
- package/dist/gen/privatews/v1/private_ws_pb.d.ts +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +1 -1
- package/dist/gen/rewards/v1/rewards_pb.d.ts +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +1 -1
- package/dist/gen/swap/v1/swap_pb.d.ts +1 -1
- package/dist/gen/system/v1/system_pb.d.ts +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +1 -1
- package/dist/gen/vip/v1/vip_pb.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/realtime/snapshot-then-stream.js +1 -1
- package/dist/server-core.js +3 -3
- package/dist/services/accounts/accounts.js +1 -1
- package/dist/services/accounts/accounts.schemas.js +1 -1
- package/dist/services/address-book/address-book.js +1 -1
- package/dist/services/api-keys/api-keys.js +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +1 -1
- package/dist/services/assistant/assistant-events.schemas.d.ts +27 -27
- package/dist/services/assistant/assistant.codecs.d.ts +1 -1
- package/dist/services/assistant/assistant.codecs.js +1 -1
- package/dist/services/assistant/assistant.codecs.js.map +1 -1
- package/dist/services/assistant/assistant.d.ts +3 -3
- package/dist/services/assistant/assistant.js +4 -4
- package/dist/services/assistant/assistant.js.map +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +1 -1
- package/dist/services/assistant/assistant.schemas.js +1 -1
- package/dist/services/auth/account-signer-auth.js +2 -2
- package/dist/services/auth/auth.js +1 -1
- package/dist/services/auth/profile/profile.js +2 -2
- package/dist/services/auto-withdraw/auto-withdraw.js +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +19 -19
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/candles/candles.js +2 -2
- package/dist/services/chain-analytics/chain-analytics.js +1 -1
- package/dist/services/changelog/changelog.js +1 -1
- package/dist/services/checkpoints/checkpoints.js +1 -1
- package/dist/services/claims/claims.js +1 -1
- package/dist/services/claims/claims.schemas.js +1 -1
- package/dist/services/deposit/deposit.js +1 -1
- package/dist/services/fees/fees.js +1 -1
- package/dist/services/guard-signer/guard-signer.js +1 -1
- package/dist/services/guard-signer/guard-signer.schemas.js +1 -1
- package/dist/services/heatmap/heatmap.js +2 -2
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.js +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.js +3 -3
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
- package/dist/services/market-data/market-data.js +2 -2
- package/dist/services/market-overview/market-overview.js +2 -2
- package/dist/services/market-overview/market-overview.schemas.js +1 -1
- package/dist/services/notifications/notifications.js +1 -1
- package/dist/services/notifications/notifications.schemas.d.ts +9 -1
- package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.js +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.js +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +7 -7
- package/dist/services/orders/orders-batch.schemas.js +2 -2
- package/dist/services/orders/orders-input.schemas.d.ts +1 -1
- package/dist/services/orders/orders-input.schemas.js +2 -2
- package/dist/services/orders/orders-modify.schemas.js +2 -2
- package/dist/services/orders/orders-output.schemas.d.ts +16 -16
- package/dist/services/orders/orders-output.schemas.js +1 -1
- package/dist/services/orders/orders-risk.schemas.js +3 -3
- package/dist/services/orders/orders.js +2 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js +1 -1
- package/dist/services/policies/shared.codecs.js +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
- package/dist/services/price-alerts/price-alerts.codecs.d.ts +1 -1
- package/dist/services/price-alerts/price-alerts.codecs.js +3 -3
- package/dist/services/price-alerts/price-alerts.codecs.js.map +1 -1
- package/dist/services/price-alerts/price-alerts.d.ts +2 -2
- package/dist/services/price-alerts/price-alerts.js +3 -3
- package/dist/services/price-alerts/price-alerts.js.map +1 -1
- package/dist/services/price-alerts/price-alerts.schemas.d.ts +11 -11
- package/dist/services/rate-limits/rate-limits.js +1 -1
- package/dist/services/rewards/rewards.js +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/social-verification/social-verification.js +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +1 -1
- package/dist/services/subaccounts/subaccounts.js +3 -3
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +5 -5
- package/dist/services/system/system.js +1 -1
- package/dist/services/trades/trades.js +2 -2
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +1 -1
- package/dist/services/trading-withdraws/wallet-message.js +1 -1
- package/dist/services/transfers/transfers.js +2 -2
- package/dist/services/triggers/trigger-child-order.schemas.js +3 -3
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/trigger-input.schemas.js +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +28 -28
- package/dist/services/triggers/triggers.js +2 -2
- package/dist/services/vip/vip.js +1 -1
- package/dist/services/vip/vip.schemas.d.ts +3 -3
- package/dist/services/vip/vip.schemas.js +1 -1
- package/dist/services/zipper/zipper.js +1 -1
- package/dist/services/zipper/zipper.schemas.js +1 -1
- package/dist/shared/error-details/alerts.js +1 -1
- package/dist/shared/error-details/assistant.js +1 -1
- package/dist/shared/error-details/auth.js +1 -1
- package/dist/shared/error-details/claims.js +1 -1
- package/dist/shared/error-details/internal-transfer.js +1 -1
- package/dist/shared/error-details/ledger.js +1 -1
- package/dist/shared/error-details/market-overview.js +1 -1
- package/dist/shared/error-details/notifications.js +1 -1
- package/dist/shared/error-details/orders.js +1 -1
- package/dist/shared/error-details/profile.js +1 -1
- package/dist/shared/error-details/rate-limit.js +1 -1
- package/dist/shared/error-details/withdraw.js +1 -1
- package/dist/shared/rate-limit.schemas.js +1 -1
- package/dist/utils/cookies.js +1 -1
- package/dist/wired-services.js +17 -17
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { U128 } from "../../polyester/type/v1/u128_pb.js";
|
|
2
|
-
import { Message } from "@bufbuild/protobuf";
|
|
3
2
|
import { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
4
3
|
import { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
4
|
+
import { Message } from "@bufbuild/protobuf";
|
|
5
5
|
declare namespace swap_pb_d_exports {
|
|
6
6
|
export { CreateSwapRequest, CreateSwapRequestSchema, CreateSwapResponse, CreateSwapResponseSchema, ErrorCode, ErrorCodeSchema, ErrorDetail, ErrorDetailSchema, GetSwapRequest, GetSwapRequestSchema, GetSwapResponse, GetSwapResponseSchema, QuoteSwapRequest, QuoteSwapRequestSchema, QuoteSwapResponse, QuoteSwapResponseSchema, Side, SideSchema, Swap, SwapOrder, SwapOrderSchema, SwapOrderStatus, SwapOrderStatusSchema, SwapQuote, SwapQuoteLeg, SwapQuoteLegSchema, SwapQuoteSchema, SwapReason, SwapReasonSchema, SwapSchema, SwapService, SwapStatus, SwapStatusSchema, SwapTerms, SwapTermsSchema, file_swap_v1_swap };
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Message } from "@bufbuild/protobuf";
|
|
2
1
|
import { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import { Message } from "@bufbuild/protobuf";
|
|
3
3
|
declare namespace system_pb_d_exports {
|
|
4
4
|
export { GetVersionRequest, GetVersionRequestSchema, GetVersionResponse, GetVersionResponseSchema, SystemService, file_system_v1_system };
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BatchCancelOrdersRequest, BatchCancelOrdersResponse, BatchCreateOrdersRequest, BatchCreateOrdersResponse, BatchReplaceOrdersRequest, BatchReplaceOrdersResponse, CancelAllAfterRequest, CancelAllAfterResponse, CancelAllOrdersRequest, CancelAllOrdersResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderRequest, CreateOrderResponse, ErrorDetail, ModifyOrderRequest, ModifyOrderResponse } from "../../orders/v1/orders_pb.js";
|
|
2
2
|
import { CancelOcoRequest, CancelOcoResponse, CreateOcoRequest, CreateOcoResponse } from "../../triggers/v1/triggers_pb.js";
|
|
3
|
-
import { Message } from "@bufbuild/protobuf";
|
|
4
3
|
import { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
4
|
+
import { Message } from "@bufbuild/protobuf";
|
|
5
5
|
declare namespace trade_ws_pb_d_exports {
|
|
6
6
|
export { AckResponse, AckResponseSchema, ClientFrame, ClientFrameSchema, CommandReject, CommandRejectSchema, OverloadResponse, OverloadResponseSchema, PingRequest, PingRequestSchema, PongResponse, PongResponseSchema, ServerFrame, ServerFrameSchema, TerminalSessionEvent, TerminalSessionEventSchema, file_tradews_v1_trade_ws };
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { U128 } from "../../polyester/type/v1/u128_pb.js";
|
|
2
|
-
import { Message } from "@bufbuild/protobuf";
|
|
3
2
|
import { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
3
|
+
import { Message } from "@bufbuild/protobuf";
|
|
4
4
|
declare namespace internal_transfer_pb_d_exports {
|
|
5
5
|
export { CreateInternalTransferRequest, CreateInternalTransferRequestSchema, CreateInternalTransferResponse, CreateInternalTransferResponseSchema, ErrorCode, ErrorCodeSchema, ErrorDetail, ErrorDetailSchema, GetInternalTransferRequest, GetInternalTransferRequestSchema, GetInternalTransferResponse, GetInternalTransferResponseSchema, InternalTransferService, InternalTransferStatus, InternalTransferStatusSchema, ResolvedDestination, ResolvedDestinationSchema, file_transfer_v1_internal_transfer };
|
|
6
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ErrorDetail, FeeAsset, RiskExecution, SelfTradePreventionMode, Side, TriggerDirection, TriggerPriceSource } from "../../orders/v1/orders_pb.js";
|
|
2
|
-
import { Message } from "@bufbuild/protobuf";
|
|
3
2
|
import { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
4
3
|
import { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
4
|
+
import { Message } from "@bufbuild/protobuf";
|
|
5
5
|
declare namespace triggers_pb_d_exports {
|
|
6
6
|
export { BatchCancelTriggersRequest, BatchCancelTriggersRequestSchema, BatchCancelTriggersResponse, BatchCancelTriggersResponseSchema, BatchCancelTriggersResultItem, BatchCancelTriggersResultItemSchema, BatchCancelTriggersResultItem_Status, BatchCancelTriggersResultItem_StatusSchema, CancelOcoRequest, CancelOcoRequestSchema, CancelOcoResponse, CancelOcoResponseSchema, CancelTriggerRequest, CancelTriggerRequestSchema, CancelTriggerResponse, CancelTriggerResponseSchema, ConditionalChildExecution, ConditionalChildExecutionSchema, ConditionalTrigger, ConditionalTriggerSchema, CreateOcoRequest, CreateOcoRequestSchema, CreateOcoResponse, CreateOcoResponseSchema, CreateTriggerRequest, CreateTriggerRequestSchema, CreateTriggerResponse, CreateTriggerResponseSchema, GetTriggerRequest, GetTriggerRequestSchema, GetTriggerResponse, GetTriggerResponseSchema, LadderDetails, LadderDetailsSchema, LadderDistribution, LadderDistributionSchema, LadderTrigger, LadderTriggerSchema, ListTriggerEventsRequest, ListTriggerEventsRequestSchema, ListTriggerEventsResponse, ListTriggerEventsResponseSchema, ListTriggersRequest, ListTriggersRequestSchema, ListTriggersResponse, ListTriggersResponseSchema, ModifyTriggerRequest, ModifyTriggerRequestSchema, ModifyTriggerResponse, ModifyTriggerResponseSchema, OcoIntent, OcoIntentSchema, OcoLeg, OcoLegSchema, PauseTriggerRequest, PauseTriggerRequestSchema, PauseTriggerResponse, PauseTriggerResponseSchema, ResumeTriggerRequest, ResumeTriggerRequestSchema, ResumeTriggerResponse, ResumeTriggerResponseSchema, StopDetails, StopDetailsSchema, TrailingDetails, TrailingDetailsSchema, TrailingStopTrigger, TrailingStopTriggerSchema, Trigger, TriggerCancelReason, TriggerCancelReasonSchema, TriggerEvent, TriggerEventBatch, TriggerEventBatchSchema, TriggerEventSchema, TriggerEventType, TriggerEventTypeSchema, TriggerFailureReason, TriggerFailureReasonSchema, TriggerIntent, TriggerIntentSchema, TriggerLimitFok, TriggerLimitFokSchema, TriggerLimitGtc, TriggerLimitGtcSchema, TriggerLimitIoc, TriggerLimitIocSchema, TriggerMarketIoc, TriggerMarketIocSchema, TriggerSchema, TriggerStatus, TriggerStatusSchema, TriggerType, TriggerTypeSchema, TriggersService, TwapDetails, TwapDetailsSchema, TwapLimitGtc, TwapLimitGtcSchema, TwapMarketIoc, TwapMarketIocSchema, TwapTrigger, TwapTriggerSchema, file_triggers_v1_triggers };
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Message } from "@bufbuild/protobuf";
|
|
2
1
|
import { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
3
2
|
import { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
3
|
+
import { Message } from "@bufbuild/protobuf";
|
|
4
4
|
declare namespace vip_pb_d_exports {
|
|
5
5
|
export { GetVIPStatusRequest, GetVIPStatusRequestSchema, GetVIPStatusResponse, GetVIPStatusResponseSchema, ListVIPTiersRequest, ListVIPTiersRequestSchema, ListVIPTiersResponse, ListVIPTiersResponseSchema, NextVIPTierThresholds, NextVIPTierThresholdsSchema, VIPMetricQuality, VIPMetricQualitySchema, VIPMetricStatus, VIPMetricStatusSchema, VIPService, VIPTier, VIPTierSchema, file_vip_v1_vip };
|
|
6
6
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, resolveAuthCookieName } from "./services/auth/cookie-constants.js";
|
|
1
2
|
import { AlreadyExistsError, AuthenticationError, ClaimOutcomeUnknownError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, NotImplementedError, OutcomeUnknownError, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterError, PreconditionFailedError, RateLimitError, RealtimeError, RequestDeadlineExceededError, RequestError, RequestTooLargeError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, SubaccountChallengeInvalidError, TimeoutError, TimestampSkewError, TransientError, UserOperationAlreadyKnownError, UserOperationNotExecutedError, UserOperationSendTimeoutError, ValidationError, WithdrawDeadlineExpiredError, errorFromHttpStatus, isAbortError, isTimeoutAbortError, normalizeErrorMessage } from "./shared/errors.js";
|
|
2
3
|
import { loadErrorDetailDecoders } from "./shared/error-detail.js";
|
|
3
4
|
import { connectErrorToPolyesterError, createErrorMappingInterceptor, toPolyesterError } from "./shared/connect-error-mapping.js";
|
|
@@ -9,7 +10,6 @@ import { validateCreateAddressBookEntryInput } from "./services/address-book/add
|
|
|
9
10
|
import { formatLedgerBalance } from "./services/balances/balances.schemas.js";
|
|
10
11
|
import { formatConnectError, formatUserFacingError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError } from "./utils/errors.js";
|
|
11
12
|
import { PolyesterClient } from "./client.js";
|
|
12
|
-
import { POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, resolveAuthCookieName } from "./services/auth/cookie-constants.js";
|
|
13
13
|
import { createCookieAuthTokenStorage, createMemoryAuthTokenStorage } from "./services/auth/token-storage.js";
|
|
14
14
|
import { PolyesterBrowserCore } from "./browser-core.js";
|
|
15
15
|
import { PolyesterBrowserClient } from "./browser-client.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { isDev } from "../utils/is-dev.js";
|
|
1
2
|
import { createSdkSubscriptionErrorContext } from "../shared/subscription-errors.js";
|
|
2
3
|
import { formatConnectError } from "../utils/errors.js";
|
|
3
|
-
import { isDev } from "../utils/is-dev.js";
|
|
4
4
|
//#region src/realtime/snapshot-then-stream.ts
|
|
5
5
|
/**
|
|
6
6
|
* Snapshot-then-stream for feed state. By default, the buffer caps at
|
package/dist/server-core.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AuthenticationError, ConfigurationError } from "./shared/errors.js";
|
|
2
|
-
import { toPolyesterError } from "./shared/connect-error-mapping.js";
|
|
3
|
-
import { PolyesterCore, parsePolyesterClientConfig, pickPolyesterCatalogConfig } from "./core-client.js";
|
|
4
1
|
import "./services/auth/cookie-constants.js";
|
|
5
2
|
import { emptyServerSessionSnapshot, parseServerSessionSnapshot } from "./services/auth/session.js";
|
|
6
3
|
import { isJwtValid } from "./utils/jwt.js";
|
|
4
|
+
import { AuthenticationError, ConfigurationError } from "./shared/errors.js";
|
|
5
|
+
import { toPolyesterError } from "./shared/connect-error-mapping.js";
|
|
6
|
+
import { PolyesterCore, parsePolyesterClientConfig, pickPolyesterCatalogConfig } from "./core-client.js";
|
|
7
7
|
//#region src/server-core.ts
|
|
8
8
|
/**
|
|
9
9
|
* Parses a serialized session cookie into SDK session data.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ResolveService } from "../../gen/auth/v1/resolve_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { ResolveService } from "../../gen/auth/v1/resolve_pb.js";
|
|
4
4
|
import { ResolveAccountInputSchema, ResolvedAccountArraySchema } from "./accounts.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/accounts/accounts.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import "../../gen/auth/v1/resolve_pb.js";
|
|
1
2
|
import { PublicIdSchema } from "../../shared/schemas.js";
|
|
2
3
|
import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
3
|
-
import "../../gen/auth/v1/resolve_pb.js";
|
|
4
4
|
import { ResolveHintCodec, ResolvedAccountKindCodec } from "./accounts.codecs.js";
|
|
5
5
|
import * as v from "valibot";
|
|
6
6
|
//#region src/services/accounts/accounts.schemas.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AddressBookService as AddressBookService$1, AddressBookViewInvalidatedSchema } from "../../gen/auth/v1/address_book_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
3
4
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
|
-
import { AddressBookService as AddressBookService$1, AddressBookViewInvalidatedSchema } from "../../gen/auth/v1/address_book_pb.js";
|
|
5
5
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
6
6
|
import { AddressBookEntriesSchema, AddressBookEntrySchema, AddressBookSchema, AddressBookTagSchema, AddressBookViewInvalidatedSchema as AddressBookViewInvalidatedSchema$1, AddressBookViewSchema, CopyAddressBookEntryInputSchema, CreateAddressBookEntryInputSchema, CreateAddressBookTagInputSchema, DeleteAddressBookEntryInputSchema, DeleteAddressBookTagInputSchema, GetAddressBookViewInputSchema, InternalTransferWhitelistEntriesSchema, ListAddressBookEntriesInputSchema, ListInternalTransferWhitelistEntriesInputSchema, ListTransferCounterpartiesInputSchema, ListTransferDestinationsInputSchema, SubaccountScopedInputSchema, TransferCounterpartiesSchema, TransferDestinationsSchema, UpdateAddressBookEntryInputSchema, UpdateAddressBookTagInputSchema, WithdrawWhitelistViewSchema } from "./address-book.schemas.js";
|
|
7
7
|
import { createClient } from "@connectrpc/connect";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ApiKeySchema, ApiKeyService } from "../../gen/auth/v1/api_keys_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
3
4
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
|
-
import { ApiKeySchema, ApiKeyService } from "../../gen/auth/v1/api_keys_pb.js";
|
|
5
5
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
6
6
|
import { ApiKeyPoliciesService } from "../policies/api-key-policies/api-key-policies.js";
|
|
7
7
|
import { ApiKeyIdInputSchema, ApiKeySchema as ApiKeySchema$1, ApiKeysCreateInputSchema, ApiKeysListInputSchema, ApiKeysSchema, ApiKeysUpdateInputSchema, SetAssistantKeysInputSchema } from "./api-keys.schemas.js";
|
|
@@ -5,8 +5,8 @@ import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shar
|
|
|
5
5
|
import { buildProtoPatch, defineProtoPatchFields } from "../../utils/proto-patch.js";
|
|
6
6
|
import { msToTimestamp } from "../../utils/timestamp.js";
|
|
7
7
|
import { API_KEY_STATUS_VALUES, API_KEY_UPDATE_STATUS_VALUES, ApiKeyPurposeCodec, ApiKeyStatusCodec } from "./api-keys.codecs.js";
|
|
8
|
-
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
9
8
|
import * as v from "valibot";
|
|
9
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
10
10
|
//#region src/services/api-keys/api-keys.schemas.ts
|
|
11
11
|
v.picklist(API_KEY_STATUS_VALUES);
|
|
12
12
|
const ApiKeyUpdateStatusSchema = v.picklist(API_KEY_UPDATE_STATUS_VALUES);
|
|
@@ -1079,7 +1079,7 @@ declare function formatApprovalPreview(p: ApprovalRequested["preview"]): {
|
|
|
1079
1079
|
quantity: string;
|
|
1080
1080
|
action: "unspecified" | "pause" | "modify" | "resume";
|
|
1081
1081
|
before: {
|
|
1082
|
-
status: "unspecified" | "
|
|
1082
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
1083
1083
|
triggerPrice: string | undefined;
|
|
1084
1084
|
trailingDistance: {
|
|
1085
1085
|
kind: "distance";
|
|
@@ -1103,7 +1103,7 @@ declare function formatApprovalPreview(p: ApprovalRequested["preview"]): {
|
|
|
1103
1103
|
limitPrice: string | undefined;
|
|
1104
1104
|
} | undefined;
|
|
1105
1105
|
after: {
|
|
1106
|
-
status: "unspecified" | "
|
|
1106
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
1107
1107
|
triggerPrice: string | undefined;
|
|
1108
1108
|
trailingDistance: {
|
|
1109
1109
|
kind: "distance";
|
|
@@ -1311,7 +1311,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1311
1311
|
attachedRisk: {
|
|
1312
1312
|
takeProfit: {
|
|
1313
1313
|
state: {
|
|
1314
|
-
status: "unspecified" | "
|
|
1314
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "not_configured" | "created" | "running";
|
|
1315
1315
|
armedTs: number | undefined;
|
|
1316
1316
|
armedTsNs: string | undefined;
|
|
1317
1317
|
terminalTs: number | undefined;
|
|
@@ -1331,7 +1331,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1331
1331
|
} | undefined;
|
|
1332
1332
|
stopLoss: {
|
|
1333
1333
|
state: {
|
|
1334
|
-
status: "unspecified" | "
|
|
1334
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "not_configured" | "created" | "running";
|
|
1335
1335
|
armedTs: number | undefined;
|
|
1336
1336
|
armedTsNs: string | undefined;
|
|
1337
1337
|
terminalTs: number | undefined;
|
|
@@ -1351,7 +1351,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1351
1351
|
} | undefined;
|
|
1352
1352
|
trailingStop: {
|
|
1353
1353
|
state: {
|
|
1354
|
-
status: "unspecified" | "
|
|
1354
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "not_configured" | "created" | "running";
|
|
1355
1355
|
armedTs: number | undefined;
|
|
1356
1356
|
armedTsNs: string | undefined;
|
|
1357
1357
|
terminalTs: number | undefined;
|
|
@@ -1397,7 +1397,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1397
1397
|
hiddenQty?: string | undefined;
|
|
1398
1398
|
symbolId: number;
|
|
1399
1399
|
clientOrderId: string;
|
|
1400
|
-
status: "unspecified" | "
|
|
1400
|
+
status: "unspecified" | "pending" | "canceled" | "rejected" | "pending_cancel" | "working" | "filled" | "partial";
|
|
1401
1401
|
side: "unspecified" | "buy" | "sell";
|
|
1402
1402
|
orderType: "unspecified" | "limit" | "market";
|
|
1403
1403
|
timeInForce: "unspecified" | "gtc" | "ioc" | "fok" | "gtd";
|
|
@@ -1436,12 +1436,12 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1436
1436
|
triggers: ({
|
|
1437
1437
|
runtimeDetails: TriggerDetailsOutput;
|
|
1438
1438
|
version: number;
|
|
1439
|
-
cancelReason: "unspecified" | "oco" | "user_request" | "account_repair" | "market_halted" | "parent_canceled_no_fill" | "self_trade_prevention" | "pair_drain_trigger" | "pair_drain_twap" | "pair_drain_ladder" | "pair_drain_attached_leg" | "missing_reason_code"
|
|
1439
|
+
cancelReason: "unspecified" | "internal_error" | "oco" | "user_request" | "account_repair" | "market_halted" | "parent_canceled_no_fill" | "self_trade_prevention" | "pair_drain_trigger" | "pair_drain_twap" | "pair_drain_ladder" | "pair_drain_attached_leg" | "missing_reason_code";
|
|
1440
1440
|
failureReason: undefined;
|
|
1441
1441
|
triggerId: string;
|
|
1442
1442
|
subaccountId: string;
|
|
1443
1443
|
symbolId: number;
|
|
1444
|
-
status: "unspecified" | "
|
|
1444
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
1445
1445
|
parentOrderId: string | undefined;
|
|
1446
1446
|
orderListId: string | undefined;
|
|
1447
1447
|
qty: string;
|
|
@@ -1623,11 +1623,11 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1623
1623
|
runtimeDetails: TriggerDetailsOutput;
|
|
1624
1624
|
version: number;
|
|
1625
1625
|
cancelReason: undefined;
|
|
1626
|
-
failureReason: "unspecified" | "
|
|
1626
|
+
failureReason: "unspecified" | "internal_error" | "market_halted" | "missing_reason_code" | "unknown_symbol" | "pair_disabled" | "min_notional" | "tick_size" | "insufficient_funds" | "risk_limit" | "duplicate_client_id" | "engine_busy" | "account_unknown" | "order_unknown" | "post_only_cross" | "reduce_only_blocked" | "price_band_violation" | "market_cap_violation" | "empty_book" | "fok_insufficient_liquidity" | "fee_asset_not_allowed" | "market_price_unavailable" | "stale_quote" | "min_quantity" | "step_size" | "invalid_sizing" | "quote_size_too_small" | "fee_ceiling_exceeded" | "trigger_price_invalid" | "trigger_price_source_unsupported" | "trailing_distance_invalid" | "modification_requires_replace" | "order_already_terminal" | "conflict_idempotency_key_reuse" | "rate_limited" | "policy_spot_trade_deny" | "policy_market_deny" | "policy_max_notional" | "policy_max_open_orders" | "policy_trading_halted" | "max_slippage_invalid" | "invalid_time_in_force" | "duplicate_order_id" | "max_quantity" | "max_notional" | "pair_post_only" | "max_open_orders_total" | "stp_mode_not_allowed" | "pair_backlogged" | "mode_not_supported" | "market_quote_stale" | "market_quote_unhealthy" | "qty_invalid" | "limit_price_invalid" | "twap_interval_invalid" | "ladder_range_too_narrow" | "ladder_levels_invalid" | "attached_legs_exceeded" | "price_levels_exhausted" | "settlement_backlogged" | "client_order_ids_exhausted" | "invalid_order_id" | "order_id_conflict" | "invalid_side" | "invalid_order_type" | "invalid_stp_mode" | "invalid_order_flags" | "price_level_quantity_limit" | "child_qty_raise_not_allowed" | "triggers_exhausted" | "order_sequence_exhausted" | "fee_schedule_unavailable" | "policy_unavailable" | "account_routing_invalid" | "client_trigger_id_invalid" | "trigger_direction_invalid" | "fee_asset_invalid" | "fee_ceiling_invalid" | "unsupported_field_set" | "trigger_fire_limit_reached" | "condition_flags_invalid" | "condition_parameter_set" | "slippage_ticks_invalid" | "slippage_bps_invalid" | "slippage_bounds_conflict" | "limit_child_slippage_set" | "new_account_capacity_reached" | "order_type_not_allowed_in_auction" | "post_only_not_allowed_in_auction" | "twap_capacity_reached" | "order_limits_unavailable" | "child_order_inconsistent" | "index_price_unavailable" | "trigger_would_trigger_immediately" | "max_open_orders_per_pair" | "account_repairing" | "self_trade_prevented";
|
|
1627
1627
|
triggerId: string;
|
|
1628
1628
|
subaccountId: string;
|
|
1629
1629
|
symbolId: number;
|
|
1630
|
-
status: "unspecified" | "
|
|
1630
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
1631
1631
|
parentOrderId: string | undefined;
|
|
1632
1632
|
orderListId: string | undefined;
|
|
1633
1633
|
qty: string;
|
|
@@ -1813,7 +1813,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1813
1813
|
triggerId: string;
|
|
1814
1814
|
subaccountId: string;
|
|
1815
1815
|
symbolId: number;
|
|
1816
|
-
status: "unspecified" | "
|
|
1816
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
1817
1817
|
parentOrderId: string | undefined;
|
|
1818
1818
|
orderListId: string | undefined;
|
|
1819
1819
|
qty: string;
|
|
@@ -2093,7 +2093,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
2093
2093
|
price: string;
|
|
2094
2094
|
referencePrice: string;
|
|
2095
2095
|
armed: boolean;
|
|
2096
|
-
status: "unspecified" | "active" | "triggered" | "
|
|
2096
|
+
status: "unspecified" | "active" | "triggered" | "canceled";
|
|
2097
2097
|
channels: ("unspecified" | "in_app" | "telegram")[];
|
|
2098
2098
|
revision: string;
|
|
2099
2099
|
createdAt: number | null;
|
|
@@ -2381,7 +2381,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
2381
2381
|
memories: {
|
|
2382
2382
|
memoryId: string;
|
|
2383
2383
|
text: string;
|
|
2384
|
-
kind: "unspecified" | "
|
|
2384
|
+
kind: "unspecified" | "profile" | "fact" | "planning_figure";
|
|
2385
2385
|
}[];
|
|
2386
2386
|
text?: undefined;
|
|
2387
2387
|
fromSeq?: undefined;
|
|
@@ -3307,7 +3307,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3307
3307
|
quantity: string;
|
|
3308
3308
|
action: "unspecified" | "pause" | "modify" | "resume";
|
|
3309
3309
|
before: {
|
|
3310
|
-
status: "unspecified" | "
|
|
3310
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
3311
3311
|
triggerPrice: string | undefined;
|
|
3312
3312
|
trailingDistance: {
|
|
3313
3313
|
kind: "distance";
|
|
@@ -3331,7 +3331,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3331
3331
|
limitPrice: string | undefined;
|
|
3332
3332
|
} | undefined;
|
|
3333
3333
|
after: {
|
|
3334
|
-
status: "unspecified" | "
|
|
3334
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
3335
3335
|
triggerPrice: string | undefined;
|
|
3336
3336
|
trailingDistance: {
|
|
3337
3337
|
kind: "distance";
|
|
@@ -3539,7 +3539,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3539
3539
|
} | {
|
|
3540
3540
|
type: "approval_resolved";
|
|
3541
3541
|
approvalId: string;
|
|
3542
|
-
status: "unspecified" | "
|
|
3542
|
+
status: "unspecified" | "pending" | "rejected" | "expired" | "approved";
|
|
3543
3543
|
text?: undefined;
|
|
3544
3544
|
fromSeq?: undefined;
|
|
3545
3545
|
toolCallId?: undefined;
|
|
@@ -3586,7 +3586,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3586
3586
|
attachedRisk: {
|
|
3587
3587
|
takeProfit: {
|
|
3588
3588
|
state: {
|
|
3589
|
-
status: "unspecified" | "
|
|
3589
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "not_configured" | "created" | "running";
|
|
3590
3590
|
armedTs: number | undefined;
|
|
3591
3591
|
armedTsNs: string | undefined;
|
|
3592
3592
|
terminalTs: number | undefined;
|
|
@@ -3606,7 +3606,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3606
3606
|
} | undefined;
|
|
3607
3607
|
stopLoss: {
|
|
3608
3608
|
state: {
|
|
3609
|
-
status: "unspecified" | "
|
|
3609
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "not_configured" | "created" | "running";
|
|
3610
3610
|
armedTs: number | undefined;
|
|
3611
3611
|
armedTsNs: string | undefined;
|
|
3612
3612
|
terminalTs: number | undefined;
|
|
@@ -3626,7 +3626,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3626
3626
|
} | undefined;
|
|
3627
3627
|
trailingStop: {
|
|
3628
3628
|
state: {
|
|
3629
|
-
status: "unspecified" | "
|
|
3629
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "not_configured" | "created" | "running";
|
|
3630
3630
|
armedTs: number | undefined;
|
|
3631
3631
|
armedTsNs: string | undefined;
|
|
3632
3632
|
terminalTs: number | undefined;
|
|
@@ -3672,7 +3672,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3672
3672
|
hiddenQty?: string | undefined;
|
|
3673
3673
|
symbolId: number;
|
|
3674
3674
|
clientOrderId: string;
|
|
3675
|
-
status: "unspecified" | "
|
|
3675
|
+
status: "unspecified" | "pending" | "canceled" | "rejected" | "pending_cancel" | "working" | "filled" | "partial";
|
|
3676
3676
|
side: "unspecified" | "buy" | "sell";
|
|
3677
3677
|
orderType: "unspecified" | "limit" | "market";
|
|
3678
3678
|
timeInForce: "unspecified" | "gtc" | "ioc" | "fok" | "gtd";
|
|
@@ -3711,12 +3711,12 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3711
3711
|
triggers: ({
|
|
3712
3712
|
runtimeDetails: TriggerDetailsOutput;
|
|
3713
3713
|
version: number;
|
|
3714
|
-
cancelReason: "unspecified" | "oco" | "user_request" | "account_repair" | "market_halted" | "parent_canceled_no_fill" | "self_trade_prevention" | "pair_drain_trigger" | "pair_drain_twap" | "pair_drain_ladder" | "pair_drain_attached_leg" | "missing_reason_code"
|
|
3714
|
+
cancelReason: "unspecified" | "internal_error" | "oco" | "user_request" | "account_repair" | "market_halted" | "parent_canceled_no_fill" | "self_trade_prevention" | "pair_drain_trigger" | "pair_drain_twap" | "pair_drain_ladder" | "pair_drain_attached_leg" | "missing_reason_code";
|
|
3715
3715
|
failureReason: undefined;
|
|
3716
3716
|
triggerId: string;
|
|
3717
3717
|
subaccountId: string;
|
|
3718
3718
|
symbolId: number;
|
|
3719
|
-
status: "unspecified" | "
|
|
3719
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
3720
3720
|
parentOrderId: string | undefined;
|
|
3721
3721
|
orderListId: string | undefined;
|
|
3722
3722
|
qty: string;
|
|
@@ -3898,11 +3898,11 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3898
3898
|
runtimeDetails: TriggerDetailsOutput;
|
|
3899
3899
|
version: number;
|
|
3900
3900
|
cancelReason: undefined;
|
|
3901
|
-
failureReason: "unspecified" | "
|
|
3901
|
+
failureReason: "unspecified" | "internal_error" | "market_halted" | "missing_reason_code" | "unknown_symbol" | "pair_disabled" | "min_notional" | "tick_size" | "insufficient_funds" | "risk_limit" | "duplicate_client_id" | "engine_busy" | "account_unknown" | "order_unknown" | "post_only_cross" | "reduce_only_blocked" | "price_band_violation" | "market_cap_violation" | "empty_book" | "fok_insufficient_liquidity" | "fee_asset_not_allowed" | "market_price_unavailable" | "stale_quote" | "min_quantity" | "step_size" | "invalid_sizing" | "quote_size_too_small" | "fee_ceiling_exceeded" | "trigger_price_invalid" | "trigger_price_source_unsupported" | "trailing_distance_invalid" | "modification_requires_replace" | "order_already_terminal" | "conflict_idempotency_key_reuse" | "rate_limited" | "policy_spot_trade_deny" | "policy_market_deny" | "policy_max_notional" | "policy_max_open_orders" | "policy_trading_halted" | "max_slippage_invalid" | "invalid_time_in_force" | "duplicate_order_id" | "max_quantity" | "max_notional" | "pair_post_only" | "max_open_orders_total" | "stp_mode_not_allowed" | "pair_backlogged" | "mode_not_supported" | "market_quote_stale" | "market_quote_unhealthy" | "qty_invalid" | "limit_price_invalid" | "twap_interval_invalid" | "ladder_range_too_narrow" | "ladder_levels_invalid" | "attached_legs_exceeded" | "price_levels_exhausted" | "settlement_backlogged" | "client_order_ids_exhausted" | "invalid_order_id" | "order_id_conflict" | "invalid_side" | "invalid_order_type" | "invalid_stp_mode" | "invalid_order_flags" | "price_level_quantity_limit" | "child_qty_raise_not_allowed" | "triggers_exhausted" | "order_sequence_exhausted" | "fee_schedule_unavailable" | "policy_unavailable" | "account_routing_invalid" | "client_trigger_id_invalid" | "trigger_direction_invalid" | "fee_asset_invalid" | "fee_ceiling_invalid" | "unsupported_field_set" | "trigger_fire_limit_reached" | "condition_flags_invalid" | "condition_parameter_set" | "slippage_ticks_invalid" | "slippage_bps_invalid" | "slippage_bounds_conflict" | "limit_child_slippage_set" | "new_account_capacity_reached" | "order_type_not_allowed_in_auction" | "post_only_not_allowed_in_auction" | "twap_capacity_reached" | "order_limits_unavailable" | "child_order_inconsistent" | "index_price_unavailable" | "trigger_would_trigger_immediately" | "max_open_orders_per_pair" | "account_repairing" | "self_trade_prevented";
|
|
3902
3902
|
triggerId: string;
|
|
3903
3903
|
subaccountId: string;
|
|
3904
3904
|
symbolId: number;
|
|
3905
|
-
status: "unspecified" | "
|
|
3905
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
3906
3906
|
parentOrderId: string | undefined;
|
|
3907
3907
|
orderListId: string | undefined;
|
|
3908
3908
|
qty: string;
|
|
@@ -4088,7 +4088,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
4088
4088
|
triggerId: string;
|
|
4089
4089
|
subaccountId: string;
|
|
4090
4090
|
symbolId: number;
|
|
4091
|
-
status: "unspecified" | "
|
|
4091
|
+
status: "unspecified" | "completed" | "failed" | "paused" | "canceled" | "armed" | "created" | "running";
|
|
4092
4092
|
parentOrderId: string | undefined;
|
|
4093
4093
|
orderListId: string | undefined;
|
|
4094
4094
|
qty: string;
|
|
@@ -4368,7 +4368,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
4368
4368
|
price: string;
|
|
4369
4369
|
referencePrice: string;
|
|
4370
4370
|
armed: boolean;
|
|
4371
|
-
status: "unspecified" | "active" | "triggered" | "
|
|
4371
|
+
status: "unspecified" | "active" | "triggered" | "canceled";
|
|
4372
4372
|
channels: ("unspecified" | "in_app" | "telegram")[];
|
|
4373
4373
|
revision: string;
|
|
4374
4374
|
createdAt: number | null;
|
|
@@ -4597,7 +4597,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
4597
4597
|
createdAt: number | undefined;
|
|
4598
4598
|
} | {
|
|
4599
4599
|
type: "run_failed";
|
|
4600
|
-
category: "unspecified" | "
|
|
4600
|
+
category: "unspecified" | "canceled" | "budget_exceeded" | "permission_denied" | "model_unavailable" | "unexpected_error";
|
|
4601
4601
|
message: string;
|
|
4602
4602
|
usage: {
|
|
4603
4603
|
inputTokens: number;
|
|
@@ -2,7 +2,7 @@ import "../../gen/ai/v1/assistant_pb.js";
|
|
|
2
2
|
//#region src/services/assistant/assistant.codecs.d.ts
|
|
3
3
|
declare const ASSISTANT_MESSAGE_ROLE_VALUES: readonly ["user", "assistant"];
|
|
4
4
|
type AssistantMessageRole = (typeof ASSISTANT_MESSAGE_ROLE_VALUES)[number];
|
|
5
|
-
declare const ASSISTANT_FAILURE_CATEGORY_VALUES: readonly ["
|
|
5
|
+
declare const ASSISTANT_FAILURE_CATEGORY_VALUES: readonly ["canceled", "budget_exceeded", "permission_denied", "model_unavailable", "unexpected_error"];
|
|
6
6
|
type AssistantFailureCategory = (typeof ASSISTANT_FAILURE_CATEGORY_VALUES)[number];
|
|
7
7
|
declare const ASSISTANT_APPROVAL_DECISION_VALUES: readonly ["approve", "reject"];
|
|
8
8
|
type AssistantApprovalDecision = (typeof ASSISTANT_APPROVAL_DECISION_VALUES)[number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.codecs.js","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const ASSISTANT_MESSAGE_ROLE_VALUES = [\"user\", \"assistant\"] as const;\nexport type AssistantMessageRole = (typeof ASSISTANT_MESSAGE_ROLE_VALUES)[number];\n\nexport const ASSISTANT_FAILURE_CATEGORY_VALUES = [\n \"
|
|
1
|
+
{"version":3,"file":"assistant.codecs.js","names":[],"sources":["../../../src/services/assistant/assistant.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const ASSISTANT_MESSAGE_ROLE_VALUES = [\"user\", \"assistant\"] as const;\nexport type AssistantMessageRole = (typeof ASSISTANT_MESSAGE_ROLE_VALUES)[number];\n\nexport const ASSISTANT_FAILURE_CATEGORY_VALUES = [\n \"canceled\",\n \"budget_exceeded\",\n \"permission_denied\",\n \"model_unavailable\",\n \"unexpected_error\",\n] as const;\nexport type AssistantFailureCategory = (typeof ASSISTANT_FAILURE_CATEGORY_VALUES)[number];\n\nexport const ASSISTANT_APPROVAL_DECISION_VALUES = [\"approve\", \"reject\"] as const;\nexport type AssistantApprovalDecision = (typeof ASSISTANT_APPROVAL_DECISION_VALUES)[number];\n\nexport const ASSISTANT_APPROVAL_STATUS_VALUES = [\n \"pending\",\n \"approved\",\n \"rejected\",\n \"expired\",\n] as const;\nexport type AssistantApprovalStatus = (typeof ASSISTANT_APPROVAL_STATUS_VALUES)[number];\n\nexport const ASSISTANT_MEMORY_KIND_VALUES = [\"fact\", \"planning_figure\", \"profile\"] as const;\nexport type AssistantMemoryKind = (typeof ASSISTANT_MEMORY_KIND_VALUES)[number];\n\nexport const ASSISTANT_KEY_STATE_VALUES = [\"active\", \"disabled\"] as const;\nexport type AssistantKeyState = (typeof ASSISTANT_KEY_STATE_VALUES)[number];\n\nexport type AssistantReferencePriceSource = \"best_bid\" | \"best_ask\" | \"last_price\" | \"index_price\";\nexport type AssistantTriggerDirection = \"at_or_above\" | \"at_or_below\";\nexport type AssistantOrderPriceField =\n | \"limit_price\"\n | \"trigger_price\"\n | \"activation_price\"\n | \"ladder_low_price\"\n | \"ladder_high_price\"\n | \"take_profit_trigger_price\"\n | \"take_profit_limit_price\"\n | \"stop_loss_trigger_price\"\n | \"stop_loss_limit_price\"\n | \"trailing_stop_activation_price\"\n | \"trailing_stop_limit_price\";\nexport type AssistantPriceOffsetDirection = \"above\" | \"below\";\nexport type AssistantPriceRounding = \"down\" | \"up\";\nexport type AssistantUnfilledSlicePolicy = \"cancel_before_next\";\nexport type AssistantTriggerChangeAction = \"modify\" | \"pause\" | \"resume\";\n\nexport const MessageRoleCodec = {\n protoToOutput: {\n [Proto.MessageRole.ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.MessageRole.USER]: \"user\",\n [Proto.MessageRole.ASSISTANT]: \"assistant\",\n } satisfies ProtoToOutput<Proto.MessageRole, AssistantMessageRole>,\n} as const;\n\nexport const FailureCategoryCodec = {\n protoToOutput: {\n [Proto.FailureCategory.FAILURE_UNSPECIFIED]: \"unspecified\",\n [Proto.FailureCategory.CANCELLED]: \"canceled\",\n [Proto.FailureCategory.BUDGET_EXCEEDED]: \"budget_exceeded\",\n [Proto.FailureCategory.PERMISSION_DENIED]: \"permission_denied\",\n [Proto.FailureCategory.MODEL_UNAVAILABLE]: \"model_unavailable\",\n [Proto.FailureCategory.UNEXPECTED_ERROR]: \"unexpected_error\",\n } satisfies ProtoToOutput<Proto.FailureCategory, AssistantFailureCategory>,\n} as const;\n\nexport const ApprovalDecisionCodec = {\n inputToProto: {\n approve: Proto.ApprovalDecision.APPROVE,\n reject: Proto.ApprovalDecision.REJECT,\n } satisfies InputToProto<AssistantApprovalDecision, Proto.ApprovalDecision>,\n} as const;\n\nexport const ApprovalStatusCodec = {\n protoToOutput: {\n [Proto.ApprovalStatus.APPROVAL_UNSPECIFIED]: \"unspecified\",\n [Proto.ApprovalStatus.PENDING]: \"pending\",\n [Proto.ApprovalStatus.APPROVED]: \"approved\",\n [Proto.ApprovalStatus.REJECTED]: \"rejected\",\n [Proto.ApprovalStatus.EXPIRED]: \"expired\",\n } satisfies ProtoToOutput<Proto.ApprovalStatus, AssistantApprovalStatus>,\n} as const;\n\nexport const MemoryKindCodec = {\n protoToOutput: {\n [Proto.MemoryKind.KIND_UNSPECIFIED]: \"unspecified\",\n [Proto.MemoryKind.FACT]: \"fact\",\n [Proto.MemoryKind.PLANNING_FIGURE]: \"planning_figure\",\n [Proto.MemoryKind.PROFILE]: \"profile\",\n } satisfies ProtoToOutput<Proto.MemoryKind, AssistantMemoryKind>,\n} as const;\n\nexport const AssistantKeyStateCodec = {\n protoToOutput: {\n [Proto.AssistantKeyState.KEY_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AssistantKeyState.ACTIVE]: \"active\",\n [Proto.AssistantKeyState.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.AssistantKeyState, AssistantKeyState>,\n} as const;\n\nexport const ReferencePriceSourceCodec = {\n protoToOutput: {\n [Proto.ReferencePriceSource.PRICE_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ReferencePriceSource.BEST_BID]: \"best_bid\",\n [Proto.ReferencePriceSource.BEST_ASK]: \"best_ask\",\n [Proto.ReferencePriceSource.LAST_PRICE]: \"last_price\",\n [Proto.ReferencePriceSource.INDEX_PRICE]: \"index_price\",\n } satisfies ProtoToOutput<Proto.ReferencePriceSource, AssistantReferencePriceSource>,\n} as const;\n\nexport const TriggerDirectionCodec = {\n protoToOutput: {\n [Proto.TriggerDirection.DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.TriggerDirection.AT_OR_ABOVE]: \"at_or_above\",\n [Proto.TriggerDirection.AT_OR_BELOW]: \"at_or_below\",\n } satisfies ProtoToOutput<Proto.TriggerDirection, AssistantTriggerDirection>,\n} as const;\n\nexport const OrderPriceFieldCodec = {\n protoToOutput: {\n [Proto.OrderPriceField.PRICE_FIELD_UNSPECIFIED]: \"unspecified\",\n [Proto.OrderPriceField.LIMIT_PRICE]: \"limit_price\",\n [Proto.OrderPriceField.TRIGGER_PRICE]: \"trigger_price\",\n [Proto.OrderPriceField.ACTIVATION_PRICE]: \"activation_price\",\n [Proto.OrderPriceField.LADDER_LOW_PRICE]: \"ladder_low_price\",\n [Proto.OrderPriceField.LADDER_HIGH_PRICE]: \"ladder_high_price\",\n [Proto.OrderPriceField.TAKE_PROFIT_TRIGGER_PRICE]: \"take_profit_trigger_price\",\n [Proto.OrderPriceField.TAKE_PROFIT_LIMIT_PRICE]: \"take_profit_limit_price\",\n [Proto.OrderPriceField.STOP_LOSS_TRIGGER_PRICE]: \"stop_loss_trigger_price\",\n [Proto.OrderPriceField.STOP_LOSS_LIMIT_PRICE]: \"stop_loss_limit_price\",\n [Proto.OrderPriceField.TRAILING_STOP_ACTIVATION_PRICE]: \"trailing_stop_activation_price\",\n [Proto.OrderPriceField.TRAILING_STOP_LIMIT_PRICE]: \"trailing_stop_limit_price\",\n } satisfies ProtoToOutput<Proto.OrderPriceField, AssistantOrderPriceField>,\n} as const;\n\nexport const PriceOffsetDirectionCodec = {\n protoToOutput: {\n [Proto.PriceOffsetDirection.OFFSET_DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.PriceOffsetDirection.ABOVE]: \"above\",\n [Proto.PriceOffsetDirection.BELOW]: \"below\",\n } satisfies ProtoToOutput<Proto.PriceOffsetDirection, AssistantPriceOffsetDirection>,\n} as const;\n\nexport const PriceRoundingCodec = {\n protoToOutput: {\n [Proto.PriceRounding.ROUNDING_UNSPECIFIED]: \"unspecified\",\n [Proto.PriceRounding.DOWN]: \"down\",\n [Proto.PriceRounding.UP]: \"up\",\n } satisfies ProtoToOutput<Proto.PriceRounding, AssistantPriceRounding>,\n} as const;\n\nexport const UnfilledSlicePolicyCodec = {\n protoToOutput: {\n [Proto.UnfilledSlicePolicy.UNFILLED_SLICE_UNSPECIFIED]: \"unspecified\",\n [Proto.UnfilledSlicePolicy.CANCEL_BEFORE_NEXT]: \"cancel_before_next\",\n } satisfies ProtoToOutput<Proto.UnfilledSlicePolicy, AssistantUnfilledSlicePolicy>,\n} as const;\n\nexport const TriggerChangeActionCodec = {\n protoToOutput: {\n [Proto.TriggerChangeAction.TRIGGER_CHANGE_UNSPECIFIED]: \"unspecified\",\n [Proto.TriggerChangeAction.MODIFY]: \"modify\",\n [Proto.TriggerChangeAction.PAUSE]: \"pause\",\n [Proto.TriggerChangeAction.RESUME]: \"resume\",\n } satisfies ProtoToOutput<Proto.TriggerChangeAction, AssistantTriggerChangeAction>,\n} as const;\n"],"mappings":";;AAeA,MAAa,qCAAqC,CAAC,WAAW,QAAQ;AAoCtE,MAAa,mBAAmB,EAC5B,eAAe;EAC2B,IAAA;EACZ,IAAA;EACK,IAAA;AACnC,EACJ;AAEA,MAAa,uBAAuB,EAChC,eAAe;EACkC,IAAA;EACV,IAAA;EACM,IAAA;EACE,IAAA;EACA,IAAA;EACD,IAAA;AAC9C,EACJ;AAEA,MAAa,wBAAwB,EACjC,cAAc;CACV,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,sBAAsB,EAC/B,eAAe;EACkC,IAAA;EACb,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;AACpC,EACJ;AAEA,MAAa,kBAAkB,EAC3B,eAAe;EAC0B,IAAA;EACZ,IAAA;EACW,IAAA;EACR,IAAA;AAChC,EACJ;AAEA,MAAa,yBAAyB,EAClC,eAAe;EACsC,IAAA;EACf,IAAA;EACE,IAAA;AACxC,EACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC4C,IAAA;EAChB,IAAA;EACA,IAAA;EACE,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,wBAAwB,EACjC,eAAe;EACqC,IAAA;EACV,IAAA;EACA,IAAA;AAC1C,EACJ;AAEA,MAAa,uBAAuB,EAChC,eAAe;EACsC,IAAA;EACZ,IAAA;EACE,IAAA;EACG,IAAA;EACA,IAAA;EACC,IAAA;EACQ,IAAA;EACF,IAAA;EACA,IAAA;EACF,IAAA;EACS,KAAA;EACL,KAAA;AACvD,EACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACgD,IAAA;EACvB,IAAA;EACA,IAAA;AACxC,EACJ;AAEA,MAAa,qBAAqB,EAC9B,eAAe;EACiC,IAAA;EAChB,IAAA;EACF,IAAA;AAC9B,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC6C,IAAA;EACR,IAAA;AACpD,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC6C,IAAA;EACpB,IAAA;EACD,IAAA;EACC,IAAA;AACxC,EACJ"}
|
|
@@ -32,8 +32,8 @@ declare class AssistantService {
|
|
|
32
32
|
*/
|
|
33
33
|
watchRun(input: WatchAssistantRunInput, options?: PolyesterRequestOptions): AsyncGenerator<AssistantRunEvent, void, undefined>;
|
|
34
34
|
/**
|
|
35
|
-
* Asks an active run to stop; it then ends with `run_failed` category `
|
|
36
|
-
*
|
|
35
|
+
* Asks an active run to stop; it then ends with `run_failed` category `canceled`.
|
|
36
|
+
* Canceling an ended run succeeds and changes nothing.
|
|
37
37
|
*/
|
|
38
38
|
cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void>;
|
|
39
39
|
/**
|
|
@@ -73,7 +73,7 @@ declare class AssistantService {
|
|
|
73
73
|
/**
|
|
74
74
|
* Returns the caller's limits on what they may approve from Telegram, in US dollars of
|
|
75
75
|
* notional value, and the value approved from Telegram in the last 24 hours while a limit
|
|
76
|
-
* was set. Limits apply to placing, swapping, modifying and resuming;
|
|
76
|
+
* was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing
|
|
77
77
|
* and rejecting are never limited.
|
|
78
78
|
*/
|
|
79
79
|
getTelegramApprovalLimits(options?: PolyesterRequestOptions): Promise<TelegramApprovalLimits & {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { AssistantService as AssistantService$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
3
4
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
5
|
import { formatId } from "../../utils/base58-id.js";
|
|
5
6
|
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
6
|
-
import { AssistantService as AssistantService$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
7
7
|
import { ApprovalStatusCodec } from "./assistant.codecs.js";
|
|
8
8
|
import { formatRunEvent } from "./assistant-events.schemas.js";
|
|
9
9
|
import { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatTelegramApprovalLimits } from "./assistant.schemas.js";
|
|
@@ -48,8 +48,8 @@ var AssistantService = class {
|
|
|
48
48
|
for await (const response of this.#client.watchRun(request, toConnectCallOptions(options))) if (response.event) yield formatRunEvent(response.event, this.#scales);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* Asks an active run to stop; it then ends with `run_failed` category `
|
|
52
|
-
*
|
|
51
|
+
* Asks an active run to stop; it then ends with `run_failed` category `canceled`.
|
|
52
|
+
* Canceling an ended run succeeds and changes nothing.
|
|
53
53
|
*/
|
|
54
54
|
async cancelRun(input, options) {
|
|
55
55
|
const request = parse(AssistantRunIdInputSchema, input);
|
|
@@ -129,7 +129,7 @@ var AssistantService = class {
|
|
|
129
129
|
/**
|
|
130
130
|
* Returns the caller's limits on what they may approve from Telegram, in US dollars of
|
|
131
131
|
* notional value, and the value approved from Telegram in the last 24 hours while a limit
|
|
132
|
-
* was set. Limits apply to placing, swapping, modifying and resuming;
|
|
132
|
+
* was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing
|
|
133
133
|
* and rejecting are never limited.
|
|
134
134
|
*/
|
|
135
135
|
async getTelegramApprovalLimits(options) {
|