@polyester/sdk 0.2.1 → 0.2.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @polyester/sdk
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#48](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/48) [`e363ba5`](https://github.com/Fabric-Labs/polyester-sdk-typescript/commit/e363ba59cb1a5e52ac8ea04f843e2562c9e29f0d) Thanks [@huntabyte](https://github.com/huntabyte)! - feat(orders): export a canonical cause-chain parser for structured order error details.
8
+
3
9
  ## 0.2.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -62,7 +62,7 @@ import { POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME } from
62
62
  import { CreateServerClientFromCookiesParams, CreateServerClientFromRequestParams, PolyesterServerClient, PolyesterServerClientConfig, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest } from "./server-client.js";
63
63
  import { connectErrorToPolyesterError, createErrorMappingInterceptor, toPolyesterError } from "./shared/connect-error-mapping.js";
64
64
  import { isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isSessionElevationRequiredError } from "./utils/connect-mfa-errors.js";
65
- import { isStaleQuoteError } from "./utils/connect-order-errors.js";
65
+ import { getOrderErrorDetail, isStaleQuoteError } from "./utils/connect-order-errors.js";
66
66
  import { formatConnectError, formatUserFacingError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError } from "./utils/errors.js";
67
67
  import { ColumnarTimeWindow, columnarTimestampSecAt, expandColumnarTimestampsSec } from "./utils/columnar-time.js";
68
68
  import { compareUnsignedIntegerStrings, shouldApplyReconciliationUpdate } from "./shared/reconciliation.js";
@@ -98,4 +98,4 @@ import "./services/transfers/transfers.types.js";
98
98
  import "./services/triggers/triggers.types.js";
99
99
  import "./services/whiteboard/whiteboard.types.js";
100
100
  import "./services/zipper/zipper.types.js";
101
- export { type AccountCodeValue, type AccountIdentity, type AccountScope, type AccountScopedInput, type AccountSigner, type AccountSignerAuthEvents, type AccountSignerConfig, type CreateSubaccountResult as AccountSignerCreateSubaccountResult, type AccountSignerFactory, type ActiveAccountInfo, type AddressBook, type AddressBookEntries, type AddressBookEntriesView, type AddressBookEntry, type AddressBookRecentDestinationsView, type AddressBookTag, type AddressBookTagSummary, type AddressBookView, type AddressBookViewInvalidated, AlreadyExistsError, type ApiKey, type ApiKeyEd25519AuthProvider, type ApiKeyIdInput, type ApiKeyPolicy, type ApiKeyPolicyApplyInput, type ApiKeyPolicyCreateInput, type ApiKeyPolicyUpdateInput, type ApiKeyStatus, type ApiKeysCreateInput, type ApiKeysListInput, type ApiKeysUpdateInput, type ArchiveWhiteboardBoardInput, type ArchiveWhiteboardBoardResult, type AssetConfig, type AuthHydrationData, type AuthLoginMethod, type AuthState, type AuthTokenStorage, type AuthTokenStorageSetOptions, AuthenticationError, type BalanceHistoryInput, type BalanceHistoryResponse, type BalanceRange, type BatchCancelOrderInput, type BatchCancelOrderResult, type BatchCancelOrdersInput, type BatchCancelOrdersResult, type BatchCreateOrderResult, type BatchCreateOrdersInput, type BatchCreateOrdersResult, type BatchGuardApprovals, type BatchReplaceAdmissionItem, type BatchReplaceOrdersInput, type BatchReplaceOrdersResult, type BatchSignProtectedActionInput, type BeginMfaChallengeInput, type BeginMfaChallengeResult, type BeginPasskeyEnrollmentInput, type BeginPasskeyEnrollmentResult, type BeginTotpEnrollmentInput, type BeginTotpEnrollmentResult, type CancelAllAfterInput, type CancelAllAfterResult, type CancelAllOrdersInput, type CancelAllOrdersResponse, type CancelOrderInput, type CancelOrderResult, type CancelTriggerInput, type CancelTriggerResult, type Candle, type CandleColumnar, type CandleColumnarInt, type CandleInt, type ChainAnalyticsRange, type ClaimFreshStepUpInput, type ClaimFreshStepUpResult, type ColumnarTimeWindow, type CompleteMfaChallengeResult, ConfigurationError, type ConnectChannelParams, type ConsumeFreshStepUpInput, type CookieAuthTokenStorageOptions, type CopyAddressBookEntryInput, type CreateAddressBookEntryInput, type CreateAddressBookTagInput, type CreateDepositAddressInput, type CreateGuardSignerWalletResult, type CreateInternalTransferInput, type CreateInternalTransferResult, type CreateOrderResult, type CreateOrderbookSubscriptionInput, type CreatePolyesterAccountSignerParams, type CreatePolyesterEnvironmentParams, type CreateServerClientFromCookiesParams, type CreateServerClientFromRequestParams, type CreateSubaccountInput, type CreateSubaccountParams, type CreateSubaccountResult$1 as CreateSubaccountResult, type CreateSubaccountResult$1 as CreateSubaccountServiceResult, type CreateTradingWithdrawResult, type CreateTradingWithdrawToExternalChainInput, type CreateTradingWithdrawToExternalChainServiceInput, type CreateTradingWithdrawToFundingInput, type CreateTradingWithdrawToFundingServiceInput, type CreateTriggerInput, type CreateTriggerResult, type CreateWhiteboardBoardInput, type CreateWhiteboardBoardResult, type DeleteAddressBookEntryInput, type DeleteAddressBookTagInput, type DeleteMfaFactorInput, type DepositAddress, type DepositWithdrawConfig, type EquityGroupBy, type EquityHistoryInput, type EquityHistoryResponse, type EquitySeries, type EquitySeriesGrouping, type EvmHex, type ExportGuardSignerWalletResult, type FinishPasskeyChallengeInput, type FinishPasskeyEnrollmentInput, type FinishPasskeyEnrollmentResult, type FinishTotpEnrollmentInput, type FinishTotpEnrollmentResult, type GetAddressBookViewInput, type GetBatchReplaceStatusInput, type GetBatchReplaceStatusResult, type GetCandlesColumnsInput, type GetCandlesInput, type GetLifecycleFlowInput, type GetLifecycleFlowOutput, type GetMarketTradesInput, type GetOrderDetailsInput, type GetOrderbookHeatmapInput, type GetOrderbookInput, type GetTriggerInput, type GetUnifiedAssetBalancesInput, type GetUserTradesInput, type GetVerificationResponse, type GetWhiteboardBoardInput, type GetWhiteboardBoardResult, type GetZippedAssetSupplyGroupInput, type GetZippedAssetSupplyInput, type GuardApproval, type GuardSignerScopedInput, type GuardSignerStatus, type HeatmapDepthValue, type HeatmapIntervalValue, type HeatmapQuantityModeValue, type HexAddress, InternalServerError, type InternalTransferDestination, type InternalTransferWhitelistEntries, type InternalTransferWhitelistEntry, type InviteSubaccountMemberInput, type JwtAuthProvider, type LadderDetailsOutput, type LedgerBalance, type LedgerTransfer, type LedgerTransferSide, type LifecycleAssetIds, type LifecycleFlowDetail, type LifecycleFlowState, type LifecycleFlowStep, type LifecycleFlowStepActivity, type LifecycleFlowSummary, type LifecycleFlowSummaryProgress, type LifecycleFlowTimelineItem, type LifecycleFlowTxMatch, type LifecycleListOrderBy, type LifecycleListScope, type LifecycleReason, type LifecycleRequestFee, type LifecycleRequestFeeStatus, type LifecycleSort, type LifecycleTxLookupKind, type LifecycleZipperReason, type ListAddressBookEntriesInput, type ListApiKeyPoliciesResponse, type ListDepositAddressesInput, type ListInternalTransferWhitelistEntriesInput, type ListLifecycleFlowsByTxInput, type ListLifecycleFlowsByTxOutput, type ListLifecycleFlowsInput, type ListLifecycleFlowsOutput, type ListMarketOverviewInput, type ListMfaFactorsResult, type ListSubaccountInvitesInput, type ListTransferCounterpartiesInput, type ListTransferDestinationsInput, type ListTransfersInput, type ListTriggerEventsInput, type ListTriggerEventsResult, type ListTriggersInput, type ListTriggersResult, type ListWhiteboardBoardsInput, type ListWhiteboardBoardsResult, type LoginOptions, type LoginResult, type LoginWithWalletInput, type LoginWithWalletResponse, type MarketOverview, type MarketOverviewOrderBy, type MarketOverviewSort, type MarketOverviewSparkline, type MarketTrade, type Me, MfaEnrollmentRequiredError, type MfaFactor, MfaLastFactorRequiredError, MfaRequiredError, type MfaSessionInfo, MfaVerificationError, type MfaVerificationFailureReason, type MintWhiteboardJoinTokenInput, type MirroredWithdrawWhitelistEntry, type ModifyOrderInput, type ModifyOrderResult, type ModifyTriggerInput, type ModifyTriggerResult, NetworkError, type NewOrderInput, type Nonce, type OpenOrdersInput, type Order, type OrderDetails, type OrderErrorCode, type OrderErrorDetail, type OrderHistoryInput, type OrderIntentInput, type OrderTransfer, type OrderbookData, type OrderbookHeatmapDeltaBucket, type OrderbookHeatmapDeltaChain, type OrderbookHeatmapDeltaLevels, type OrderbookHeatmapKeyframe, type OrderbookHeatmapLevels, type OrderbookHeatmapLiveBucket, type OrderbookHeatmapResponse, type OrderbookLevel, type OrderbookStreamHandlers, type OrderbookSubscription, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, type PairConfig, type PairStatus, PermissionError, type PolicyAction, PolicyInUseError, PolicyLockedError, type PolicyMarketScope, PolicyScopeMismatchError, type PolyesterAccountAbstractionEnvironment, PolyesterBrowserClient, type PolyesterBrowserClientConfig, PolyesterClient, type PolyesterClientBaseConfig, type PolyesterClientConfig, type PolyesterContractsEnvironment, type PolyesterEntryPointConfig, type PolyesterEnvironment, PolyesterError, type PolyesterErrorCode, type PolyesterErrorOptions, type PolyesterMutationOptions, type PolyesterRealtime, type PolyesterRealtimeAuthConfig, type PolyesterRequestOptions, type PolyesterSafeDeploymentConfig, PolyesterServerClient, type PolyesterServerClientConfig, PreconditionFailedError, type PreparedTradingWithdraw, type PreviewOrderResult, type Profile, type RateLimitDetail, RateLimitError, type RateLimitErrorOptions, type RateLimitFailureReason, type RateLimitPolicyClass, type RateLimitRefillModel, type RateLimitScope, type RegenerateRecoveryCodesInput, type RegenerateRecoveryCodesResult, type ReleaseFreshStepUpInput, type RemoveSubaccountMemberInput, RequestError, type ResolveAccountInput, type ResolvedAccount, type ResolvedInternalTransferDestination, ResourceNotFoundError, type RespondSubaccountInviteInput, RevisionConflictError, type RiskPolicyInput, type RotateGuardSignerWalletResult, type SdkSubscriptionErrorContext, type ServerSessionSnapshot, ServiceUnavailableError, type SessionData, SessionElevationRequiredError, type SetSubaccountMemberMfaRequirementInput, type SignProtectedActionInput, type SocialProvider, type SocialProviderInput, type SocialVerification, type SocialVerificationMethod, type SocialVerificationStatus, type SparklineIntervalName, type SpotConfig, StaleQuoteError, type StartVerificationInput, type StartVerificationResponse, StepUpRequiredError, type StopDetailsOutput, type StopLossInput, type Subaccount, type SubaccountActivityInput, type SubaccountEvent, type SubaccountIdInput, type SubaccountInvite, type SubaccountInviteStatus, type SubaccountMember, type SubaccountPolicy, type SubaccountPolicyApplyInput, type SubaccountPolicyCreateInput, type SubaccountPolicyUpdateInput, type SubaccountRole, type SubaccountScopedInput, type SubaccountStatus, type SubscribeHandlers, type SubscribeZippedAssetSupplyInput, type TakeProfitInput, type Timeframe, TimeoutError, type Trade, type TradingWithdrawSigningConfig, type TradingWithdrawWalletSigner, type TradingWithdrawWalletTypedData, type TrailingDetailsOutput, type TrailingStopInput, type TransferCodeValue, type TransferCounterparties, type TransferCounterparty, type TransferDestination, type TransferDestinations, type TransferSideKind, TransientError, type Transports, type Trigger, type TriggerDetailsOutput, type TriggerEvent, type TwapDetailsOutput, type UnifiedAssetBalancesResponse, type UpdateAddressBookEntryInput, type UpdateAddressBookTagInput, type UpdateMfaFactorInput, type UpdateMfaFactorResult, type UpdateProfileInput, type UpdateSubaccountInput, type UpdateSubaccountMemberRoleInput, type UpdateWhiteboardBoardAclInput, type UpdateWhiteboardBoardAclResult, type UpdateWhiteboardBoardInput, type UpdateWhiteboardBoardResult, type UsernameHistoryEntry, type ValidateWithdrawDestinationInput, type ValidateWithdrawDestinationResult, ValidationError, type VerificationReadyResponse, type VerifyRecoveryCodeChallengeInput, type VerifyTotpChallengeInput, type WhiteboardAccess, type WhiteboardAclEntry, type WhiteboardAclEntryInput, type WhiteboardAclSubjectType, type WhiteboardAudience, type WhiteboardBoard, type WhiteboardBoardDetails, type WhiteboardBoardListItem, type WhiteboardJoinTokenResult, type WhiteboardPermissions, type WhiteboardPresencePayload, type WhiteboardResolvedRole, type WhiteboardSnapshot, type WhiteboardWritableRole, type WithdrawWhitelistView, type ZippedAssetSupplyBatch, type ZippedAssetSupplyGroupResponse, type ZippedAssetSupplyResponse, type ZippedAssetSupplySeries, type ZippedAssetSupplyUpdate, type ZipperAssetChainVariant, type ZipperAssetConfig, type ZipperChainConfig, type ZipperChainContractConfig, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, isStaleQuoteError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
101
+ export { type AccountCodeValue, type AccountIdentity, type AccountScope, type AccountScopedInput, type AccountSigner, type AccountSignerAuthEvents, type AccountSignerConfig, type CreateSubaccountResult as AccountSignerCreateSubaccountResult, type AccountSignerFactory, type ActiveAccountInfo, type AddressBook, type AddressBookEntries, type AddressBookEntriesView, type AddressBookEntry, type AddressBookRecentDestinationsView, type AddressBookTag, type AddressBookTagSummary, type AddressBookView, type AddressBookViewInvalidated, AlreadyExistsError, type ApiKey, type ApiKeyEd25519AuthProvider, type ApiKeyIdInput, type ApiKeyPolicy, type ApiKeyPolicyApplyInput, type ApiKeyPolicyCreateInput, type ApiKeyPolicyUpdateInput, type ApiKeyStatus, type ApiKeysCreateInput, type ApiKeysListInput, type ApiKeysUpdateInput, type ArchiveWhiteboardBoardInput, type ArchiveWhiteboardBoardResult, type AssetConfig, type AuthHydrationData, type AuthLoginMethod, type AuthState, type AuthTokenStorage, type AuthTokenStorageSetOptions, AuthenticationError, type BalanceHistoryInput, type BalanceHistoryResponse, type BalanceRange, type BatchCancelOrderInput, type BatchCancelOrderResult, type BatchCancelOrdersInput, type BatchCancelOrdersResult, type BatchCreateOrderResult, type BatchCreateOrdersInput, type BatchCreateOrdersResult, type BatchGuardApprovals, type BatchReplaceAdmissionItem, type BatchReplaceOrdersInput, type BatchReplaceOrdersResult, type BatchSignProtectedActionInput, type BeginMfaChallengeInput, type BeginMfaChallengeResult, type BeginPasskeyEnrollmentInput, type BeginPasskeyEnrollmentResult, type BeginTotpEnrollmentInput, type BeginTotpEnrollmentResult, type CancelAllAfterInput, type CancelAllAfterResult, type CancelAllOrdersInput, type CancelAllOrdersResponse, type CancelOrderInput, type CancelOrderResult, type CancelTriggerInput, type CancelTriggerResult, type Candle, type CandleColumnar, type CandleColumnarInt, type CandleInt, type ChainAnalyticsRange, type ClaimFreshStepUpInput, type ClaimFreshStepUpResult, type ColumnarTimeWindow, type CompleteMfaChallengeResult, ConfigurationError, type ConnectChannelParams, type ConsumeFreshStepUpInput, type CookieAuthTokenStorageOptions, type CopyAddressBookEntryInput, type CreateAddressBookEntryInput, type CreateAddressBookTagInput, type CreateDepositAddressInput, type CreateGuardSignerWalletResult, type CreateInternalTransferInput, type CreateInternalTransferResult, type CreateOrderResult, type CreateOrderbookSubscriptionInput, type CreatePolyesterAccountSignerParams, type CreatePolyesterEnvironmentParams, type CreateServerClientFromCookiesParams, type CreateServerClientFromRequestParams, type CreateSubaccountInput, type CreateSubaccountParams, type CreateSubaccountResult$1 as CreateSubaccountResult, type CreateSubaccountResult$1 as CreateSubaccountServiceResult, type CreateTradingWithdrawResult, type CreateTradingWithdrawToExternalChainInput, type CreateTradingWithdrawToExternalChainServiceInput, type CreateTradingWithdrawToFundingInput, type CreateTradingWithdrawToFundingServiceInput, type CreateTriggerInput, type CreateTriggerResult, type CreateWhiteboardBoardInput, type CreateWhiteboardBoardResult, type DeleteAddressBookEntryInput, type DeleteAddressBookTagInput, type DeleteMfaFactorInput, type DepositAddress, type DepositWithdrawConfig, type EquityGroupBy, type EquityHistoryInput, type EquityHistoryResponse, type EquitySeries, type EquitySeriesGrouping, type EvmHex, type ExportGuardSignerWalletResult, type FinishPasskeyChallengeInput, type FinishPasskeyEnrollmentInput, type FinishPasskeyEnrollmentResult, type FinishTotpEnrollmentInput, type FinishTotpEnrollmentResult, type GetAddressBookViewInput, type GetBatchReplaceStatusInput, type GetBatchReplaceStatusResult, type GetCandlesColumnsInput, type GetCandlesInput, type GetLifecycleFlowInput, type GetLifecycleFlowOutput, type GetMarketTradesInput, type GetOrderDetailsInput, type GetOrderbookHeatmapInput, type GetOrderbookInput, type GetTriggerInput, type GetUnifiedAssetBalancesInput, type GetUserTradesInput, type GetVerificationResponse, type GetWhiteboardBoardInput, type GetWhiteboardBoardResult, type GetZippedAssetSupplyGroupInput, type GetZippedAssetSupplyInput, type GuardApproval, type GuardSignerScopedInput, type GuardSignerStatus, type HeatmapDepthValue, type HeatmapIntervalValue, type HeatmapQuantityModeValue, type HexAddress, InternalServerError, type InternalTransferDestination, type InternalTransferWhitelistEntries, type InternalTransferWhitelistEntry, type InviteSubaccountMemberInput, type JwtAuthProvider, type LadderDetailsOutput, type LedgerBalance, type LedgerTransfer, type LedgerTransferSide, type LifecycleAssetIds, type LifecycleFlowDetail, type LifecycleFlowState, type LifecycleFlowStep, type LifecycleFlowStepActivity, type LifecycleFlowSummary, type LifecycleFlowSummaryProgress, type LifecycleFlowTimelineItem, type LifecycleFlowTxMatch, type LifecycleListOrderBy, type LifecycleListScope, type LifecycleReason, type LifecycleRequestFee, type LifecycleRequestFeeStatus, type LifecycleSort, type LifecycleTxLookupKind, type LifecycleZipperReason, type ListAddressBookEntriesInput, type ListApiKeyPoliciesResponse, type ListDepositAddressesInput, type ListInternalTransferWhitelistEntriesInput, type ListLifecycleFlowsByTxInput, type ListLifecycleFlowsByTxOutput, type ListLifecycleFlowsInput, type ListLifecycleFlowsOutput, type ListMarketOverviewInput, type ListMfaFactorsResult, type ListSubaccountInvitesInput, type ListTransferCounterpartiesInput, type ListTransferDestinationsInput, type ListTransfersInput, type ListTriggerEventsInput, type ListTriggerEventsResult, type ListTriggersInput, type ListTriggersResult, type ListWhiteboardBoardsInput, type ListWhiteboardBoardsResult, type LoginOptions, type LoginResult, type LoginWithWalletInput, type LoginWithWalletResponse, type MarketOverview, type MarketOverviewOrderBy, type MarketOverviewSort, type MarketOverviewSparkline, type MarketTrade, type Me, MfaEnrollmentRequiredError, type MfaFactor, MfaLastFactorRequiredError, MfaRequiredError, type MfaSessionInfo, MfaVerificationError, type MfaVerificationFailureReason, type MintWhiteboardJoinTokenInput, type MirroredWithdrawWhitelistEntry, type ModifyOrderInput, type ModifyOrderResult, type ModifyTriggerInput, type ModifyTriggerResult, NetworkError, type NewOrderInput, type Nonce, type OpenOrdersInput, type Order, type OrderDetails, type OrderErrorCode, type OrderErrorDetail, type OrderHistoryInput, type OrderIntentInput, type OrderTransfer, type OrderbookData, type OrderbookHeatmapDeltaBucket, type OrderbookHeatmapDeltaChain, type OrderbookHeatmapDeltaLevels, type OrderbookHeatmapKeyframe, type OrderbookHeatmapLevels, type OrderbookHeatmapLiveBucket, type OrderbookHeatmapResponse, type OrderbookLevel, type OrderbookStreamHandlers, type OrderbookSubscription, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, type PairConfig, type PairStatus, PermissionError, type PolicyAction, PolicyInUseError, PolicyLockedError, type PolicyMarketScope, PolicyScopeMismatchError, type PolyesterAccountAbstractionEnvironment, PolyesterBrowserClient, type PolyesterBrowserClientConfig, PolyesterClient, type PolyesterClientBaseConfig, type PolyesterClientConfig, type PolyesterContractsEnvironment, type PolyesterEntryPointConfig, type PolyesterEnvironment, PolyesterError, type PolyesterErrorCode, type PolyesterErrorOptions, type PolyesterMutationOptions, type PolyesterRealtime, type PolyesterRealtimeAuthConfig, type PolyesterRequestOptions, type PolyesterSafeDeploymentConfig, PolyesterServerClient, type PolyesterServerClientConfig, PreconditionFailedError, type PreparedTradingWithdraw, type PreviewOrderResult, type Profile, type RateLimitDetail, RateLimitError, type RateLimitErrorOptions, type RateLimitFailureReason, type RateLimitPolicyClass, type RateLimitRefillModel, type RateLimitScope, type RegenerateRecoveryCodesInput, type RegenerateRecoveryCodesResult, type ReleaseFreshStepUpInput, type RemoveSubaccountMemberInput, RequestError, type ResolveAccountInput, type ResolvedAccount, type ResolvedInternalTransferDestination, ResourceNotFoundError, type RespondSubaccountInviteInput, RevisionConflictError, type RiskPolicyInput, type RotateGuardSignerWalletResult, type SdkSubscriptionErrorContext, type ServerSessionSnapshot, ServiceUnavailableError, type SessionData, SessionElevationRequiredError, type SetSubaccountMemberMfaRequirementInput, type SignProtectedActionInput, type SocialProvider, type SocialProviderInput, type SocialVerification, type SocialVerificationMethod, type SocialVerificationStatus, type SparklineIntervalName, type SpotConfig, StaleQuoteError, type StartVerificationInput, type StartVerificationResponse, StepUpRequiredError, type StopDetailsOutput, type StopLossInput, type Subaccount, type SubaccountActivityInput, type SubaccountEvent, type SubaccountIdInput, type SubaccountInvite, type SubaccountInviteStatus, type SubaccountMember, type SubaccountPolicy, type SubaccountPolicyApplyInput, type SubaccountPolicyCreateInput, type SubaccountPolicyUpdateInput, type SubaccountRole, type SubaccountScopedInput, type SubaccountStatus, type SubscribeHandlers, type SubscribeZippedAssetSupplyInput, type TakeProfitInput, type Timeframe, TimeoutError, type Trade, type TradingWithdrawSigningConfig, type TradingWithdrawWalletSigner, type TradingWithdrawWalletTypedData, type TrailingDetailsOutput, type TrailingStopInput, type TransferCodeValue, type TransferCounterparties, type TransferCounterparty, type TransferDestination, type TransferDestinations, type TransferSideKind, TransientError, type Transports, type Trigger, type TriggerDetailsOutput, type TriggerEvent, type TwapDetailsOutput, type UnifiedAssetBalancesResponse, type UpdateAddressBookEntryInput, type UpdateAddressBookTagInput, type UpdateMfaFactorInput, type UpdateMfaFactorResult, type UpdateProfileInput, type UpdateSubaccountInput, type UpdateSubaccountMemberRoleInput, type UpdateWhiteboardBoardAclInput, type UpdateWhiteboardBoardAclResult, type UpdateWhiteboardBoardInput, type UpdateWhiteboardBoardResult, type UsernameHistoryEntry, type ValidateWithdrawDestinationInput, type ValidateWithdrawDestinationResult, ValidationError, type VerificationReadyResponse, type VerifyRecoveryCodeChallengeInput, type VerifyTotpChallengeInput, type WhiteboardAccess, type WhiteboardAclEntry, type WhiteboardAclEntryInput, type WhiteboardAclSubjectType, type WhiteboardAudience, type WhiteboardBoard, type WhiteboardBoardDetails, type WhiteboardBoardListItem, type WhiteboardJoinTokenResult, type WhiteboardPermissions, type WhiteboardPresencePayload, type WhiteboardResolvedRole, type WhiteboardSnapshot, type WhiteboardWritableRole, type WithdrawWhitelistView, type ZippedAssetSupplyBatch, type ZippedAssetSupplyGroupResponse, type ZippedAssetSupplyResponse, type ZippedAssetSupplySeries, type ZippedAssetSupplyUpdate, type ZipperAssetChainVariant, type ZipperAssetConfig, type ZipperChainConfig, type ZipperChainContractConfig, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, getOrderErrorDetail, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, isStaleQuoteError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
package/dist/index.js CHANGED
@@ -13,6 +13,6 @@ import { PolyesterBrowserClient } from "./browser-client.js";
13
13
  import { PolyesterServerClient, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest } from "./server-client.js";
14
14
  import { POLYESTER_TESTNET_ENVIRONMENT, createPolyesterEnvironment } from "./environment.js";
15
15
  import { isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isSessionElevationRequiredError } from "./utils/connect-mfa-errors.js";
16
- import { isStaleQuoteError } from "./utils/connect-order-errors.js";
16
+ import { getOrderErrorDetail, isStaleQuoteError } from "./utils/connect-order-errors.js";
17
17
  import { columnarTimestampSecAt, expandColumnarTimestampsSec } from "./utils/columnar-time.js";
18
- export { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterBrowserClient, PolyesterClient, PolyesterError, PolyesterServerClient, PreconditionFailedError, RateLimitError, RequestError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, TimeoutError, TransientError, ValidationError, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, isStaleQuoteError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
18
+ export { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterBrowserClient, PolyesterClient, PolyesterError, PolyesterServerClient, PreconditionFailedError, RateLimitError, RequestError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, TimeoutError, TransientError, ValidationError, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, getOrderErrorDetail, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, isStaleQuoteError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
@@ -14,7 +14,7 @@ type TimestampInit = {
14
14
  declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
15
15
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>]>;
16
16
  readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1h" | "1m" | "1s" | "5m", HeatmapInterval>]>;
17
- readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 500 | 1000 | 100 | 50, HeatmapDepth>]>;
17
+ readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 500 | 1000 | 50 | 100, HeatmapDepth>]>;
18
18
  readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
19
19
  readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>, undefined>;
20
20
  readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
@@ -227,7 +227,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
227
227
  declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
228
228
  readonly symbolId: v.NumberSchema<undefined>;
229
229
  readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1h" | "1m" | "1s" | "5m">>]>;
230
- readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 500 | 1000 | 100 | 50>]>;
230
+ readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 500 | 1000 | 50 | 100>]>;
231
231
  readonly chain: v.OptionalSchema<v.ObjectSchema<{
232
232
  readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
233
233
  readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
@@ -287,7 +287,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
287
287
  }, undefined>, v.TransformAction<{
288
288
  symbolId: number;
289
289
  interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
290
- depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 500 | 1000 | 100 | 50;
290
+ depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 500 | 1000 | 50 | 100;
291
291
  chain?: {
292
292
  baseKeyframe?: {
293
293
  tsSec: number;
@@ -347,7 +347,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
347
347
  }, {
348
348
  symbolId: number;
349
349
  interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
350
- depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 500 | 1000 | 100 | 50;
350
+ depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 500 | 1000 | 50 | 100;
351
351
  chain: {
352
352
  baseKeyframe: {
353
353
  tsSec: number;
@@ -11,7 +11,7 @@ declare const GetOrderbookInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
11
11
  depth: number;
12
12
  }, {
13
13
  symbol: string;
14
- depth: 5 | 10 | 20 | 1 | 200 | 500 | 1000 | 100 | 50;
14
+ depth: 5 | 10 | 20 | 1 | 200 | 500 | 1000 | 50 | 100;
15
15
  protoDepth: Depth;
16
16
  }>]>;
17
17
  type GetOrderbookInput = v.InferInput<typeof GetOrderbookInputSchema>;
@@ -176,7 +176,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
176
176
  readonly granteeAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
177
177
  readonly inviterAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
178
178
  readonly role: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountRole$1, undefined>, v.TransformAction<SubaccountRole$1, "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer">]>;
179
- readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountInviteStatus$1, undefined>, v.TransformAction<SubaccountInviteStatus$1, "unspecified" | "pending" | "cancelled" | "accepted" | "declined">]>;
179
+ readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountInviteStatus$1, undefined>, v.TransformAction<SubaccountInviteStatus$1, "unspecified" | "pending" | "accepted" | "declined" | "cancelled">]>;
180
180
  readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
181
181
  readonly seconds: v.BigintSchema<undefined>;
182
182
  readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
@@ -203,7 +203,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
203
203
  granteeAccountId: string;
204
204
  inviterAccountId: string;
205
205
  role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
206
- status: "unspecified" | "pending" | "cancelled" | "accepted" | "declined";
206
+ status: "unspecified" | "pending" | "accepted" | "declined" | "cancelled";
207
207
  createdAt?: number | undefined;
208
208
  respondedAt?: number | undefined;
209
209
  granteeUsername: string;
@@ -221,7 +221,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
221
221
  granteeAccountId: string;
222
222
  inviterAccountId: string;
223
223
  role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
224
- status: "unspecified" | "pending" | "cancelled" | "accepted" | "declined";
224
+ status: "unspecified" | "pending" | "accepted" | "declined" | "cancelled";
225
225
  createdAt?: number | undefined;
226
226
  respondedAt?: number | undefined;
227
227
  granteeUsername: string;
@@ -243,8 +243,8 @@ declare const SubaccountActivityEventSchema: v.ObjectSchema<{
243
243
  seconds: bigint;
244
244
  nanos: number;
245
245
  } | undefined, number | undefined>]>;
246
- readonly entityKind: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEntityKind, undefined>, v.TransformAction<ActivityEntityKind, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "policy" | "member" | "invite" | "security">]>;
247
- readonly eventAction: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventAction, undefined>, v.TransformAction<ActivityEventAction, "unspecified" | "enabled" | "disabled" | "failed" | "revoked" | "deleted" | "created" | "updated" | "removed" | "role_set" | "received" | "replied" | "blocked" | "hold_placed" | "hold_released">]>;
246
+ readonly entityKind: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEntityKind, undefined>, v.TransformAction<ActivityEntityKind, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "member" | "policy" | "invite" | "security">]>;
247
+ readonly eventAction: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventAction, undefined>, v.TransformAction<ActivityEventAction, "unspecified" | "enabled" | "disabled" | "revoked" | "deleted" | "created" | "updated" | "removed" | "role_set" | "received" | "replied" | "failed" | "blocked" | "hold_placed" | "hold_released">]>;
248
248
  readonly source: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventSource, undefined>, v.TransformAction<ActivityEventSource, "unspecified" | "web" | "mobile" | "api">]>;
249
249
  readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
250
250
  readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -787,7 +787,7 @@ type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInpu
787
787
  declare const ListTriggersInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
788
788
  readonly parentOrderId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
789
789
  readonly symbol: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
790
- readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
790
+ readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
791
791
  readonly triggerType: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["stop_loss", "take_profit", "trailing_stop", "twap", "ladder"], undefined>, undefined>, v.TransformAction<"twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop" | undefined, TriggerType>]>;
792
792
  readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, 50>;
793
793
  readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
@@ -31,62 +31,62 @@ declare const CreateTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSche
31
31
  type CreateTriggerResult = v.InferOutput<typeof CreateTriggerResultSchema>;
32
32
  declare const CancelTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
33
33
  readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
34
- readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
34
+ readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused">]>;
35
35
  readonly tsNs: v.BigintSchema<undefined>;
36
36
  }, undefined>, v.TransformAction<{
37
37
  triggerId: string;
38
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
38
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
39
39
  tsNs: bigint;
40
40
  }, {
41
41
  ts: number;
42
42
  tsNs: string;
43
43
  triggerId: string;
44
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
44
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
45
45
  }>]>;
46
46
  type CancelTriggerResult = v.InferOutput<typeof CancelTriggerResultSchema>;
47
47
  declare const ModifyTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
48
48
  readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
49
- readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
49
+ readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused">]>;
50
50
  readonly tsNs: v.BigintSchema<undefined>;
51
51
  }, undefined>, v.TransformAction<{
52
52
  triggerId: string;
53
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
53
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
54
54
  tsNs: bigint;
55
55
  }, {
56
56
  ts: number;
57
57
  tsNs: string;
58
58
  triggerId: string;
59
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
59
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
60
60
  }>]>;
61
61
  type ModifyTriggerResult = v.InferOutput<typeof ModifyTriggerResultSchema>;
62
62
  declare const PauseTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
63
63
  readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
64
- readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
64
+ readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused">]>;
65
65
  readonly tsNs: v.BigintSchema<undefined>;
66
66
  }, undefined>, v.TransformAction<{
67
67
  triggerId: string;
68
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
68
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
69
69
  tsNs: bigint;
70
70
  }, {
71
71
  ts: number;
72
72
  tsNs: string;
73
73
  triggerId: string;
74
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
74
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
75
75
  }>]>;
76
76
  type PauseTriggerResult = v.InferOutput<typeof PauseTriggerResultSchema>;
77
77
  declare const ResumeTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
78
78
  readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
79
- readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
79
+ readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused">]>;
80
80
  readonly tsNs: v.BigintSchema<undefined>;
81
81
  }, undefined>, v.TransformAction<{
82
82
  triggerId: string;
83
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
83
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
84
84
  tsNs: bigint;
85
85
  }, {
86
86
  ts: number;
87
87
  tsNs: string;
88
88
  triggerId: string;
89
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
89
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
90
90
  }>]>;
91
91
  type ResumeTriggerResult = v.InferOutput<typeof ResumeTriggerResultSchema>;
92
92
  type StopDetailsOutput = {
@@ -507,7 +507,7 @@ declare function createTriggerSchema(scales: SdkScales): v.SchemaWithPipe<readon
507
507
  subaccountId: string;
508
508
  symbolId: number;
509
509
  symbol: string;
510
- status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
510
+ status: "unspecified" | "cancelled" | "created" | "failed" | "completed" | "armed" | "running" | "paused";
511
511
  parentOrderId: string | undefined;
512
512
  qty: string;
513
513
  feeAsset: "unspecified" | "quote" | "base";
@@ -1,9 +1,15 @@
1
+ import { OrderErrorDetail } from "../services/orders/order-errors.schemas.js";
1
2
  //#region src/utils/connect-order-errors.d.ts
3
+ /**
4
+ * Returns the first structured Orders API rejection detail in an error cause chain.
5
+ * Invalid or unrelated details are ignored rather than exposing transport prose.
6
+ */
7
+ declare function getOrderErrorDetail(error: unknown): OrderErrorDetail | undefined;
2
8
  /**
3
9
  * True when an order mutation was rejected because its client reference quote
4
10
  * exceeded the backend's configured drift limit.
5
11
  */
6
12
  declare function isStaleQuoteError(error: unknown): boolean;
7
13
  //#endregion
8
- export { isStaleQuoteError };
14
+ export { getOrderErrorDetail, isStaleQuoteError };
9
15
  //# sourceMappingURL=connect-order-errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-order-errors.d.ts","names":[],"sources":["../../src/utils/connect-order-errors.ts"],"mappings":";;;;;iBAOgB,kBAAkB"}
1
+ {"version":3,"file":"connect-order-errors.d.ts","names":[],"sources":["../../src/utils/connect-order-errors.ts"],"mappings":";;;;;;iBAcgB,oBAAoB,iBAAiB;;;;;iBAsBrC,kBAAkB"}
@@ -1,7 +1,28 @@
1
1
  import { StaleQuoteError } from "../shared/errors.js";
2
+ import { ErrorDetailSchema } from "../gen/orders/v1/orders_pb.js";
2
3
  import { toPolyesterError } from "../shared/connect-error-mapping.js";
4
+ import { OrderErrorDetailSchema } from "../services/orders/order-errors.schemas.js";
5
+ import { ConnectError } from "@connectrpc/connect";
6
+ import * as v from "valibot";
3
7
  //#region src/utils/connect-order-errors.ts
4
8
  /**
9
+ * Returns the first structured Orders API rejection detail in an error cause chain.
10
+ * Invalid or unrelated details are ignored rather than exposing transport prose.
11
+ */
12
+ function getOrderErrorDetail(error) {
13
+ const seen = /* @__PURE__ */ new Set();
14
+ let current = error;
15
+ for (let depth = 0; depth < 5 && current != null && !seen.has(current); depth += 1) {
16
+ seen.add(current);
17
+ const details = ConnectError.from(current).findDetails(ErrorDetailSchema);
18
+ for (const detail of details) {
19
+ const parsed = v.safeParse(OrderErrorDetailSchema, detail);
20
+ if (parsed.success) return parsed.output;
21
+ }
22
+ current = current instanceof Error ? current.cause : void 0;
23
+ }
24
+ }
25
+ /**
5
26
  * True when an order mutation was rejected because its client reference quote
6
27
  * exceeded the backend's configured drift limit.
7
28
  */
@@ -15,6 +36,6 @@ function isStaleQuoteError(error) {
15
36
  return false;
16
37
  }
17
38
  //#endregion
18
- export { isStaleQuoteError };
39
+ export { getOrderErrorDetail, isStaleQuoteError };
19
40
 
20
41
  //# sourceMappingURL=connect-order-errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-order-errors.js","names":[],"sources":["../../src/utils/connect-order-errors.ts"],"sourcesContent":["import { toPolyesterError } from \"../shared/connect-error-mapping.js\";\nimport { StaleQuoteError } from \"../shared/errors.js\";\n\n/**\n * True when an order mutation was rejected because its client reference quote\n * exceeded the backend's configured drift limit.\n */\nexport function isStaleQuoteError(error: unknown): boolean {\n let current = error;\n\n for (let depth = 0; depth < 5; depth += 1) {\n if (toPolyesterError(current) instanceof StaleQuoteError) return true;\n if (!(current instanceof Error) || current.cause === undefined) return false;\n current = current.cause;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,kBAAkB,OAAyB;CACvD,IAAI,UAAU;CAEd,KAAK,IAAI,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG;EACvC,IAAI,iBAAiB,OAAO,aAAa,iBAAiB,OAAO;EACjE,IAAI,EAAE,mBAAmB,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;EACvE,UAAU,QAAQ;CACtB;CAEA,OAAO;AACX"}
1
+ {"version":3,"file":"connect-order-errors.js","names":[],"sources":["../../src/utils/connect-order-errors.ts"],"sourcesContent":["import { ConnectError } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { ErrorDetailSchema } from \"../gen/orders/v1/orders_pb.js\";\nimport {\n OrderErrorDetailSchema,\n type OrderErrorDetail,\n} from \"../services/orders/order-errors.schemas.js\";\nimport { toPolyesterError } from \"../shared/connect-error-mapping.js\";\nimport { StaleQuoteError } from \"../shared/errors.js\";\n\n/**\n * Returns the first structured Orders API rejection detail in an error cause chain.\n * Invalid or unrelated details are ignored rather than exposing transport prose.\n */\nexport function getOrderErrorDetail(error: unknown): OrderErrorDetail | undefined {\n const seen = new Set<unknown>();\n let current: unknown = error;\n\n for (let depth = 0; depth < 5 && current != null && !seen.has(current); depth += 1) {\n seen.add(current);\n const details = ConnectError.from(current).findDetails(ErrorDetailSchema);\n for (const detail of details) {\n const parsed = v.safeParse(OrderErrorDetailSchema, detail);\n if (parsed.success) return parsed.output;\n }\n\n current = current instanceof Error ? current.cause : undefined;\n }\n\n return undefined;\n}\n\n/**\n * True when an order mutation was rejected because its client reference quote\n * exceeded the backend's configured drift limit.\n */\nexport function isStaleQuoteError(error: unknown): boolean {\n let current = error;\n\n for (let depth = 0; depth < 5; depth += 1) {\n if (toPolyesterError(current) instanceof StaleQuoteError) return true;\n if (!(current instanceof Error) || current.cause === undefined) return false;\n current = current.cause;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;AAcA,SAAgB,oBAAoB,OAA8C;CAC9E,MAAM,uBAAO,IAAI,IAAa;CAC9B,IAAI,UAAmB;CAEvB,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,WAAW,QAAQ,CAAC,KAAK,IAAI,OAAO,GAAG,SAAS,GAAG;EAChF,KAAK,IAAI,OAAO;EAChB,MAAM,UAAU,aAAa,KAAK,OAAO,CAAC,CAAC,YAAY,iBAAiB;EACxE,KAAK,MAAM,UAAU,SAAS;GAC1B,MAAM,SAAS,EAAE,UAAU,wBAAwB,MAAM;GACzD,IAAI,OAAO,SAAS,OAAO,OAAO;EACtC;EAEA,UAAU,mBAAmB,QAAQ,QAAQ,QAAQ,KAAA;CACzD;AAGJ;;;;;AAMA,SAAgB,kBAAkB,OAAyB;CACvD,IAAI,UAAU;CAEd,KAAK,IAAI,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG;EACvC,IAAI,iBAAiB,OAAO,aAAa,iBAAiB,OAAO;EACjE,IAAI,EAAE,mBAAmB,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;EACvE,UAAU,QAAQ;CACtB;CAEA,OAAO;AACX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polyester/sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
5
  "description": "TypeScript SDK providing access to APIs on Polyester Exchange.",
6
6
  "homepage": "https://github.com/Fabric-Labs/polyester-sdk-typescript#readme",