@polymarket/bindings 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-JPPG656Y.js +2 -0
- package/dist/chunk-JPPG656Y.js.map +1 -0
- package/dist/chunk-YXNKEMRF.js +2 -0
- package/dist/chunk-YXNKEMRF.js.map +1 -0
- package/dist/chunk-ZMJTXTXA.js +2 -0
- package/dist/chunk-ZMJTXTXA.js.map +1 -0
- package/dist/clob/index.d.ts +489 -8
- package/dist/clob/index.js +1 -1
- package/dist/clob/index.js.map +1 -1
- package/dist/combos/index.d.ts +1 -1
- package/dist/combos/index.js +1 -1
- package/dist/combos/index.js.map +1 -1
- package/dist/{comment-CKJIqOZS.d.ts → comment-tQ-L48Di.d.ts} +2 -2
- package/dist/data/index.d.ts +446 -10
- package/dist/data/index.js +1 -1
- package/dist/data/index.js.map +1 -1
- package/dist/gamma/index.d.ts +79 -4
- package/dist/gamma/index.js +1 -1
- package/dist/gamma/index.js.map +1 -1
- package/dist/index.d.ts +108 -213
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{orders-BMW5PN-Q.d.ts → orders-SIFuRgWc.d.ts} +608 -35
- package/dist/perps/index.d.ts +995 -4
- package/dist/perps/index.js +1 -1
- package/dist/perps/index.js.map +1 -1
- package/dist/relayer/index.d.ts +1 -1
- package/dist/relayer/index.js +1 -1
- package/dist/shared-QrXQ5O6x.d.ts +223 -0
- package/dist/subscriptions/index.d.ts +668 -78
- package/dist/subscriptions/index.js +1 -1
- package/dist/subscriptions/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-2FRDSBWY.js +0 -2
- package/dist/chunk-2FRDSBWY.js.map +0 -1
- package/dist/chunk-3IZ4N7C2.js +0 -2
- package/dist/chunk-3IZ4N7C2.js.map +0 -1
- package/dist/chunk-DAWT25YZ.js +0 -2
- package/dist/chunk-DAWT25YZ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,217 +1,112 @@
|
|
|
1
|
-
import { HexString, EvmAddress, TxHash } from '@polymarket/types';
|
|
2
|
-
export { EvmAddress, TxHash } from '@polymarket/types';
|
|
3
1
|
import { z } from 'zod';
|
|
2
|
+
export { A as ApiKey, a as ApiKeySchema, B as BaseUnits, b as BaseUnitsSchema, c as BestLineId, d as BuilderCode, e as BuilderCodeSchema, C as CategoryId, f as CategoryIdSchema, g as ChatId, h as ClobAssetId, i as ClobAssetIdSchema, j as ClobRewardId, k as ClobRewardIdSchema, l as CollectionId, m as ComboActivityId, n as ComboActivityIdSchema, o as ComboConditionId, p as ComboConditionIdSchema, q as CommentId, r as CommentIdSchema, s as CommentParentEntityType, t as CommentParentEntityTypeSchema, u as ConditionId, v as ConditionIdResponseSchema, w as ConditionIdSchema, x as CtfConditionId, D as DateLikeToIsoDateTimeStringSchema, y as DecimalString, z as DecimalStringSchema, E as DecimalishSchema, F as E6BigIntStringToDecimalStringSchema, G as EpochLikeToIsoDateTimeStringSchema, H as EpochMilliseconds, I as EpochMillisecondsSchema, J as EpochMillisecondsStringSchema, K as EpochMillisecondsToIsoDateTimeStringSchema, L as EpochSecondsToMillisecondsSchema, M as EventCreatorId, N as EventExternalPartnerMappingId, O as EventId, P as EventIdSchema, Q as EvmAddressSchema, R as ISOCalendarDateSchema, S as ISOCalendarDateString, T as ISODateString, U as ISODateStringSchema, V as ImageOptimizationId, W as ImageOptimizationIdSchema, X as InternalUserId, Y as InternalUserIdSchema, Z as IsoCalendarDateString, _ as IsoCalendarDateStringSchema, $ as IsoDateTimeString, a0 as IsoDateTimeStringSchema, a1 as MarketId, a2 as MarketIdSchema, a3 as MixedDateTimeString, a4 as MixedDateTimeStringSchema, a5 as NegRiskEventId, a6 as NegRiskEventIdSchema, a7 as NotificationId, a8 as NotificationIdSchema, a9 as OptionalDateLikeToIsoDateTimeStringSchema, aa as OptionalDecimalStringSchema, ab as OptionalEpochLikeToIsoDateTimeStringSchema, ac as OptionalEpochMillisecondsToIsoDateTimeStringSchema, ad as OrderId, ae as OrderIdSchema, af as OrderSide, ag as OrderSideSchema, ah as OrderType, ai as OrderTypeSchema, aj as PaginationCursor, ak as PaginationCursorSchema, al as PartnerId, am as PositionId, an as PositionIdSchema, ao as PositiveDecimalNumberSchema, ap as QuestionId, aq as QuestionIdSchema, ar as ResolutionRequestId, as as ResolutionRequestIdSchema, at as RfqId, au as RfqIdSchema, av as RfqQuoteId, aw as RfqQuoteIdSchema, ax as RfqRequestorPublicId, ay as RfqRequestorPublicIdSchema, az as SeriesId, aA as SessionSignerKnownScope, aB as SessionSignerScope, aC as SessionSignerScopeSchema, aD as SportId, aE as TagId, aF as TagIdSchema, aG as TeamId, aH as TemplateId, aI as TickSizeValue, aJ as TickSizeValueSchema, aK as TokenId, aL as TokenIdSchema, aM as TradeStatus, aN as TradeStatusSchema, aO as TransactionId, aP as TransactionIdSchema, aQ as TxHashSchema, aR as Uuid, aS as emptyStringToNull, aT as emptyStringToUndefined, aU as toApiKey, aV as toBaseUnits, aW as toBestLineId, aX as toBuilderCode, aY as toCategoryId, aZ as toChatId, a_ as toClobRewardId, a$ as toCollectionId, b0 as toComboActivityId, b1 as toComboConditionId, b2 as toCommentId, b3 as toConditionId, b4 as toDecimalString, b5 as toEpochMilliseconds, b6 as toEventCreatorId, b7 as toEventExternalPartnerMappingId, b8 as toEventId, b9 as toImageOptimizationId, ba as toInternalUserId, bb as toIsoCalendarDateString, bc as toIsoDateTimeString, bd as toMarketId, be as toMixedDateTimeString, bf as toNotificationId, bg as toOrderId, bh as toPaginationCursor, bi as toPartnerId, bj as toPositionId, bk as toQuestionId, bl as toResolutionRequestId, bm as toRfqId, bn as toRfqQuoteId, bo as toRfqRequestorPublicId, bp as toSeriesId, bq as toSportId, br as toTagId, bs as toTeamId, bt as toTemplateId, bu as toTokenId, bv as toTransactionId, bw as toUuid } from './shared-QrXQ5O6x.js';
|
|
3
|
+
export { EvmAddress, TxHash } from '@polymarket/types';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
/** Known rejection codes; unknown future codes remain valid. */
|
|
6
|
+
declare enum GatewayKnownErrorCode {
|
|
7
|
+
InvalidCursor = "invalid_cursor",
|
|
8
|
+
InvalidQueryParam = "invalid_query_param",
|
|
9
|
+
InvalidPathParam = "invalid_path_param",
|
|
10
|
+
InvalidRequestBody = "invalid_request_body",
|
|
11
|
+
InsufficientLiquidity = "insufficient_liquidity",
|
|
12
|
+
InvalidApiKey = "invalid_api_key",
|
|
13
|
+
InvalidCredentials = "invalid_credentials",
|
|
14
|
+
LoginRejected = "login_rejected",
|
|
15
|
+
InvalidOrderTokenId = "invalid_order_token_id",
|
|
16
|
+
InvalidOrderPrice = "invalid_order_price",
|
|
17
|
+
InvalidBuilderCode = "invalid_builder_code",
|
|
18
|
+
InvalidOrderExpiration = "invalid_order_expiration",
|
|
19
|
+
InvalidOrderAmount = "invalid_order_amount",
|
|
20
|
+
InvalidOrderIdentity = "invalid_order_identity",
|
|
21
|
+
OrderTooSmall = "order_too_small",
|
|
22
|
+
InvalidClobCredentials = "invalid_clob_credentials",
|
|
23
|
+
PayloadTooLarge = "payload_too_large",
|
|
24
|
+
InvalidBuilderCredentials = "invalid_builder_credentials",
|
|
25
|
+
UpstreamUnavailable = "upstream_unavailable",
|
|
26
|
+
RateLimited = "rate_limited",
|
|
27
|
+
SubmissionOutcomeUnknown = "submission_outcome_unknown",
|
|
28
|
+
CancelOutcomeUnknown = "cancel_outcome_unknown",
|
|
29
|
+
RfqOutcomeUnknown = "rfq_outcome_unknown",
|
|
30
|
+
BuilderAttributionUnsupported = "builder_attribution_unsupported",
|
|
31
|
+
RestrictedRegionCloseOnly = "restricted_region_close_only",
|
|
32
|
+
NotFound = "not_found",
|
|
33
|
+
EventArchived = "event_archived",
|
|
34
|
+
MarketNotFound = "market_not_found",
|
|
35
|
+
DepositWalletNotFound = "deposit_wallet_not_found",
|
|
36
|
+
InvalidTransaction = "invalid_transaction",
|
|
37
|
+
TransactionNotAllowed = "transaction_not_allowed",
|
|
38
|
+
DuplicateInFlightNonce = "duplicate_in_flight_nonce",
|
|
39
|
+
InternalError = "internal_error",
|
|
40
|
+
InvalidAccessToken = "invalid_access_token",
|
|
41
|
+
ExpiredAccessToken = "expired_access_token",
|
|
42
|
+
ApiKeyMismatch = "api_key_mismatch",
|
|
43
|
+
IdentityProviderUnavailable = "identity_provider_unavailable",
|
|
44
|
+
IdentityProviderProtocolError = "identity_provider_protocol_error",
|
|
45
|
+
InvalidSigner = "invalid_signer",
|
|
46
|
+
InvalidSignature = "invalid_signature",
|
|
47
|
+
MalformedRefreshToken = "malformed_refresh_token",
|
|
48
|
+
ChallengeNotFound = "challenge_not_found",
|
|
49
|
+
ChallengeExpired = "challenge_expired",
|
|
50
|
+
InvalidAttestation = "invalid_attestation",
|
|
51
|
+
InvalidRefreshToken = "invalid_refresh_token",
|
|
52
|
+
ChallengeConsumed = "challenge_consumed",
|
|
53
|
+
InvalidWallet = "invalid_wallet",
|
|
54
|
+
WalletNotAuthorized = "wallet_not_authorized"
|
|
21
55
|
}
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
type OrderId = Tagged<string, 'OrderId'>;
|
|
78
|
-
type PartnerId = Tagged<number, 'PartnerId'>;
|
|
79
|
-
type PaginationCursor = Tagged<string, 'PaginationCursor'>;
|
|
80
|
-
type PositionId = Tagged<string, 'PositionId'>;
|
|
81
|
-
type QuestionId = Tagged<HexString, 'QuestionId'>;
|
|
82
|
-
type ResolutionRequestId = Tagged<HexString, 'ResolutionRequestId'>;
|
|
83
|
-
type RfqId = Tagged<string, 'RfqId'>;
|
|
84
|
-
type RfqQuoteId = Tagged<string, 'RfqQuoteId'>;
|
|
85
|
-
type RfqRequestorPublicId = Tagged<string, 'RfqRequestorPublicId'>;
|
|
86
|
-
type SeriesId = Tagged<string, 'SeriesId'>;
|
|
87
|
-
type SportId = Tagged<number, 'SportId'>;
|
|
88
|
-
type TagId = Tagged<string, 'TagId'>;
|
|
89
|
-
type TeamId = Tagged<number, 'TeamId'>;
|
|
90
|
-
type TemplateId = Tagged<string, 'TemplateId'>;
|
|
91
|
-
type TransactionId = Tagged<string, 'TransactionId'>;
|
|
92
|
-
type TokenId = Tagged<string, 'TokenId'>;
|
|
93
|
-
/** Identifier accepted by CLOB asset fields. */
|
|
94
|
-
type ClobAssetId = PositionId | TokenId;
|
|
95
|
-
type DecimalString = Tagged<string, 'DecimalString'>;
|
|
96
|
-
type BaseUnits = Tagged<string, 'BaseUnits'>;
|
|
97
|
-
declare function toBestLineId(value: string): BestLineId;
|
|
98
|
-
declare function toBuilderCode(value: string): BuilderCode;
|
|
99
|
-
declare function toUuid(value: string): Uuid;
|
|
100
|
-
declare function toApiKey(value: string): ApiKey;
|
|
101
|
-
declare function toCategoryId(value: string): CategoryId;
|
|
102
|
-
declare function toChatId(value: string): ChatId;
|
|
103
|
-
declare function toClobRewardId(value: string): ClobRewardId;
|
|
104
|
-
declare function toCommentId(value: string): CommentId;
|
|
105
|
-
declare function toComboActivityId(value: string): ComboActivityId;
|
|
106
|
-
declare function toConditionId(value: string): ConditionId;
|
|
107
|
-
declare function toComboConditionId(value: string): ComboConditionId;
|
|
108
|
-
declare function toCollectionId(value: string): CollectionId;
|
|
109
|
-
declare function toEventCreatorId(value: string): EventCreatorId;
|
|
110
|
-
declare function toEventExternalPartnerMappingId(value: number): EventExternalPartnerMappingId;
|
|
111
|
-
declare function toEpochMilliseconds(value: number): EpochMilliseconds;
|
|
112
|
-
declare function toEventId(value: string): EventId;
|
|
113
|
-
declare function toImageOptimizationId(value: string): ImageOptimizationId;
|
|
114
|
-
declare function toInternalUserId(value: string): InternalUserId;
|
|
115
|
-
declare function toIsoCalendarDateString(value: string): IsoCalendarDateString;
|
|
116
|
-
declare function toIsoDateTimeString(value: string): IsoDateTimeString;
|
|
117
|
-
declare function toMixedDateTimeString(value: string): MixedDateTimeString;
|
|
118
|
-
declare function toMarketId(value: string): MarketId;
|
|
119
|
-
declare function toNotificationId(value: number): NotificationId;
|
|
120
|
-
declare function toOrderId(value: string): OrderId;
|
|
121
|
-
declare function toPartnerId(value: number): PartnerId;
|
|
122
|
-
declare function toPaginationCursor(value: string): PaginationCursor;
|
|
123
|
-
declare function toPositionId(value: string): PositionId;
|
|
124
|
-
declare function toQuestionId(value: string): QuestionId;
|
|
125
|
-
declare function toResolutionRequestId(value: string): ResolutionRequestId;
|
|
126
|
-
declare function toRfqId(value: string): RfqId;
|
|
127
|
-
declare function toRfqQuoteId(value: string): RfqQuoteId;
|
|
128
|
-
declare function toRfqRequestorPublicId(value: string): RfqRequestorPublicId;
|
|
129
|
-
declare function toSeriesId(value: string): SeriesId;
|
|
130
|
-
declare function toSportId(value: number): SportId;
|
|
131
|
-
declare function toTagId(value: string): TagId;
|
|
132
|
-
declare function toTeamId(value: number): TeamId;
|
|
133
|
-
declare function toTemplateId(value: string): TemplateId;
|
|
134
|
-
declare function toTransactionId(value: string): TransactionId;
|
|
135
|
-
declare function toTokenId(value: string): TokenId;
|
|
136
|
-
declare function toDecimalString(value: string): DecimalString;
|
|
137
|
-
declare function toBaseUnits(value: string): BaseUnits;
|
|
138
|
-
declare const CategoryIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<CategoryId, string>>;
|
|
139
|
-
declare const ApiKeySchema: z.ZodPipe<z.ZodString, z.ZodTransform<ApiKey, string>>;
|
|
140
|
-
declare const BuilderCodeSchema: z.ZodPipe<z.ZodString, z.ZodTransform<BuilderCode, string>>;
|
|
141
|
-
declare const ClobRewardIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ClobRewardId, string>>;
|
|
142
|
-
declare const CommentIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<CommentId, string>>;
|
|
143
|
-
declare const ComboActivityIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ComboActivityId, string>>;
|
|
144
|
-
declare const ComboConditionIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ComboConditionId, string>>;
|
|
145
|
-
declare const ConditionIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ConditionId, string>>;
|
|
146
|
-
declare const ConditionIdResponseSchema: z.ZodCustom<ConditionId, ConditionId>;
|
|
147
|
-
declare const EvmAddressSchema: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
|
|
148
|
-
declare const EpochMillisecondsSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
|
|
149
|
-
declare const EpochSecondsToMillisecondsSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
|
|
150
|
-
declare const EpochMillisecondsStringSchema: z.ZodPipe<z.ZodString, z.ZodTransform<EpochMilliseconds, string>>;
|
|
151
|
-
declare const DateLikeToIsoDateTimeStringSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<IsoDateTimeString, number>>, z.ZodPipe<z.ZodString, z.ZodTransform<IsoDateTimeString, string>>]>;
|
|
152
|
-
declare const EpochLikeToIsoDateTimeStringSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<IsoDateTimeString, number>>, z.ZodPipe<z.ZodString, z.ZodTransform<IsoDateTimeString, string>>]>;
|
|
153
|
-
declare const OptionalDateLikeToIsoDateTimeStringSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<IsoDateTimeString | undefined, number>>, z.ZodPipe<z.ZodString, z.ZodTransform<IsoDateTimeString, string>>]>;
|
|
154
|
-
declare const OptionalEpochLikeToIsoDateTimeStringSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<IsoDateTimeString | undefined, number>>, z.ZodPipe<z.ZodString, z.ZodTransform<IsoDateTimeString, string>>]>;
|
|
155
|
-
declare const EpochMillisecondsToIsoDateTimeStringSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<IsoDateTimeString, number>>, z.ZodPipe<z.ZodString, z.ZodTransform<IsoDateTimeString, string>>]>;
|
|
156
|
-
declare const OptionalEpochMillisecondsToIsoDateTimeStringSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodTransform<IsoDateTimeString | undefined, number>>, z.ZodPipe<z.ZodString, z.ZodTransform<IsoDateTimeString, string>>]>;
|
|
157
|
-
declare const EventIdSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>]>, z.ZodTransform<EventId, string>>;
|
|
158
|
-
declare const TickSizeValueSchema: z.ZodUnion<readonly [z.ZodLiteral<0.1>, z.ZodLiteral<0.01>, z.ZodLiteral<0.005>, z.ZodLiteral<0.0025>, z.ZodLiteral<0.001>, z.ZodLiteral<0.0001>]>;
|
|
159
|
-
declare const IsoDateTimeStringSchema: z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodTransform<IsoDateTimeString, string>>, z.ZodPipe<z.ZodDate, z.ZodTransform<IsoDateTimeString, Date>>]>;
|
|
160
|
-
declare const IsoCalendarDateStringSchema: z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodTransform<IsoCalendarDateString, string>>, z.ZodPipe<z.ZodDate, z.ZodTransform<IsoCalendarDateString, Date>>]>;
|
|
161
|
-
declare const MixedDateTimeStringSchema: z.ZodPipe<z.ZodString, z.ZodTransform<MixedDateTimeString, string>>;
|
|
162
|
-
declare const ISODateStringSchema: z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodTransform<IsoDateTimeString, string>>, z.ZodPipe<z.ZodDate, z.ZodTransform<IsoDateTimeString, Date>>]>;
|
|
163
|
-
declare const ISOCalendarDateSchema: z.ZodUnion<[z.ZodPipe<z.ZodString, z.ZodTransform<IsoCalendarDateString, string>>, z.ZodPipe<z.ZodDate, z.ZodTransform<IsoCalendarDateString, Date>>]>;
|
|
164
|
-
declare const ImageOptimizationIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ImageOptimizationId, string>>;
|
|
165
|
-
declare const InternalUserIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<InternalUserId, string>>;
|
|
166
|
-
declare const MarketIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<MarketId, string>>;
|
|
167
|
-
declare const NotificationIdSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<NotificationId, number>>;
|
|
168
|
-
declare const CommentParentEntityTypeSchema: z.ZodEnum<typeof CommentParentEntityType>;
|
|
169
|
-
declare const OrderIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<OrderId, string>>;
|
|
170
|
-
declare const OrderSideSchema: z.ZodEnum<typeof OrderSide>;
|
|
171
|
-
declare const OrderTypeSchema: z.ZodEnum<typeof OrderType>;
|
|
172
|
-
declare const TradeStatusSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodEnum<typeof TradeStatus>>;
|
|
173
|
-
declare const PaginationCursorSchema: z.ZodCustom<PaginationCursor, PaginationCursor>;
|
|
174
|
-
declare const PositionIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
|
|
175
|
-
/**
|
|
176
|
-
* CLOB payloads do not distinguish CTF token IDs from Polymarket V2 position
|
|
177
|
-
* IDs, so preserve both possible branded types when parsing an asset ID.
|
|
178
|
-
*/
|
|
179
|
-
declare const ClobAssetIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId | TokenId, string>>;
|
|
180
|
-
declare const QuestionIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<QuestionId, string>>;
|
|
181
|
-
declare const ResolutionRequestIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ResolutionRequestId, string>>;
|
|
182
|
-
declare const RfqIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>;
|
|
183
|
-
declare const RfqQuoteIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<RfqQuoteId, string>>;
|
|
184
|
-
declare const RfqRequestorPublicIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<RfqRequestorPublicId, string>>;
|
|
185
|
-
declare const TagIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<TagId, string>>;
|
|
186
|
-
declare const TokenIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<TokenId, string>>;
|
|
187
|
-
declare const TransactionIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<TransactionId, string>>;
|
|
188
|
-
declare const TxHashSchema: z.ZodPipe<z.ZodString, z.ZodTransform<TxHash, string>>;
|
|
189
|
-
declare const DecimalStringSchema: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
190
|
-
declare const E6BigIntStringToDecimalStringSchema: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
191
|
-
declare const DecimalishSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<DecimalString, number>>]>;
|
|
192
|
-
declare const PositiveDecimalNumberSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodNumber>;
|
|
193
|
-
declare const BaseUnitsSchema: z.ZodPipe<z.ZodString, z.ZodTransform<BaseUnits, string>>;
|
|
194
|
-
type ISODateString = IsoDateTimeString;
|
|
195
|
-
type ISOCalendarDateString = IsoCalendarDateString;
|
|
196
|
-
type TickSizeValue = z.output<typeof TickSizeValueSchema>;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Preprocess helper for upstream fields that serialize missing values as empty
|
|
200
|
-
* strings. Use as `z.preprocess(emptyStringToNull, Schema.nullable())`, or
|
|
201
|
-
* with `.nullish()` when the field can also be absent.
|
|
202
|
-
*/
|
|
203
|
-
declare function emptyStringToNull(value: unknown): unknown;
|
|
204
|
-
/**
|
|
205
|
-
* Preprocess helper for upstream fields that omit missing values or serialize
|
|
206
|
-
* them as empty strings. Normalizes `''` to `undefined` so the field can parse
|
|
207
|
-
* as `Schema.optional()`.
|
|
208
|
-
*/
|
|
209
|
-
declare function emptyStringToUndefined(value: unknown): unknown;
|
|
210
|
-
/**
|
|
211
|
-
* Optional decimal field whose upstream serialization uses an empty string
|
|
212
|
-
* for missing values. Normalizes `''` to `null` so consumers never receive
|
|
213
|
-
* an empty `DecimalString`; populated values parse as `DecimalStringSchema`.
|
|
214
|
-
*/
|
|
215
|
-
declare const OptionalDecimalStringSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>>>>;
|
|
56
|
+
/** A known rejection code or an unrecognized code returned by the server. */
|
|
57
|
+
type GatewayErrorCode = GatewayKnownErrorCode | (string & {});
|
|
58
|
+
/** Native error envelope, retaining unrecognized codes for forward compatibility. */
|
|
59
|
+
declare const GatewayErrorResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
60
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<GatewayKnownErrorCode | (string & {}), string>>;
|
|
61
|
+
message: z.ZodString;
|
|
62
|
+
retry_after_seconds: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodTransform<number | undefined, number | null | undefined>>;
|
|
63
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
64
|
+
code: GatewayKnownErrorCode | (string & {});
|
|
65
|
+
message: string;
|
|
66
|
+
retryAfter: number | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
code: GatewayKnownErrorCode | (string & {});
|
|
69
|
+
message: string;
|
|
70
|
+
retry_after_seconds: number | undefined;
|
|
71
|
+
}>>;
|
|
72
|
+
/** Upstream error envelope normalized to the transport's error fields. */
|
|
73
|
+
declare const PassthroughErrorResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
74
|
+
error: z.ZodString;
|
|
75
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
retry_after_seconds: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodTransform<number | undefined, number | null | undefined>>;
|
|
77
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
78
|
+
message: string;
|
|
79
|
+
code: string | undefined;
|
|
80
|
+
retryAfter: number | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
error: string;
|
|
83
|
+
retry_after_seconds: number | undefined;
|
|
84
|
+
code?: string | null | undefined;
|
|
85
|
+
}>>;
|
|
86
|
+
declare const ErrorResponseSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
|
|
87
|
+
error: z.ZodString;
|
|
88
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
|
+
retry_after_seconds: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodTransform<number | undefined, number | null | undefined>>;
|
|
90
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
91
|
+
message: string;
|
|
92
|
+
code: string | undefined;
|
|
93
|
+
retryAfter: number | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
error: string;
|
|
96
|
+
retry_after_seconds: number | undefined;
|
|
97
|
+
code?: string | null | undefined;
|
|
98
|
+
}>>, z.ZodPipe<z.ZodObject<{
|
|
99
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<GatewayKnownErrorCode | (string & {}), string>>;
|
|
100
|
+
message: z.ZodString;
|
|
101
|
+
retry_after_seconds: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodTransform<number | undefined, number | null | undefined>>;
|
|
102
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
103
|
+
code: GatewayKnownErrorCode | (string & {});
|
|
104
|
+
message: string;
|
|
105
|
+
retryAfter: number | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
code: GatewayKnownErrorCode | (string & {});
|
|
108
|
+
message: string;
|
|
109
|
+
retry_after_seconds: number | undefined;
|
|
110
|
+
}>>]>;
|
|
216
111
|
|
|
217
|
-
export {
|
|
112
|
+
export { ErrorResponseSchema, type GatewayErrorCode, GatewayErrorResponseSchema, GatewayKnownErrorCode, PassthroughErrorResponseSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{X as ApiKeySchema,Ta as BaseUnitsSchema,Y as BuilderCodeSchema,W as CategoryIdSchema,Fa as ClobAssetIdSchema,Z as ClobRewardIdSchema,$ as ComboActivityIdSchema,aa as ComboConditionIdSchema,_ as CommentIdSchema,a as CommentParentEntityType,ya as CommentParentEntityTypeSchema,ca as ConditionIdResponseSchema,ba as ConditionIdSchema,ha as DateLikeToIsoDateTimeStringSchema,Pa as DecimalStringSchema,Ra as DecimalishSchema,Qa as E6BigIntStringToDecimalStringSchema,ia as EpochLikeToIsoDateTimeStringSchema,ea as EpochMillisecondsSchema,ga as EpochMillisecondsStringSchema,la as EpochMillisecondsToIsoDateTimeStringSchema,fa as EpochSecondsToMillisecondsSchema,na as EventIdSchema,da as EvmAddressSchema,ta as ISOCalendarDateSchema,sa as ISODateStringSchema,ua as ImageOptimizationIdSchema,va as InternalUserIdSchema,qa as IsoCalendarDateStringSchema,pa as IsoDateTimeStringSchema,wa as MarketIdSchema,ra as MixedDateTimeStringSchema,g as NegRiskEventIdSchema,xa as NotificationIdSchema,ja as OptionalDateLikeToIsoDateTimeStringSchema,Wa as OptionalDecimalStringSchema,ka as OptionalEpochLikeToIsoDateTimeStringSchema,ma as OptionalEpochMillisecondsToIsoDateTimeStringSchema,za as OrderIdSchema,b as OrderSide,Aa as OrderSideSchema,c as OrderType,Ba as OrderTypeSchema,Da as PaginationCursorSchema,Ea as PositionIdSchema,Sa as PositiveDecimalNumberSchema,Ga as QuestionIdSchema,Ha as ResolutionRequestIdSchema,Ia as RfqIdSchema,Ja as RfqQuoteIdSchema,Ka as RfqRequestorPublicIdSchema,e as SessionSignerKnownScope,f as SessionSignerScopeSchema,La as TagIdSchema,oa as TickSizeValueSchema,Ma as TokenIdSchema,d as TradeStatus,Ca as TradeStatusSchema,Na as TransactionIdSchema,Oa as TxHashSchema,Ua as emptyStringToNull,Va as emptyStringToUndefined,k as toApiKey,V as toBaseUnits,h as toBestLineId,i as toBuilderCode,l as toCategoryId,m as toChatId,n as toClobRewardId,s as toCollectionId,p as toComboActivityId,r as toComboConditionId,o as toCommentId,q as toConditionId,U as toDecimalString,v as toEpochMilliseconds,t as toEventCreatorId,u as toEventExternalPartnerMappingId,w as toEventId,x as toImageOptimizationId,y as toInternalUserId,z as toIsoCalendarDateString,A as toIsoDateTimeString,C as toMarketId,B as toMixedDateTimeString,D as toNotificationId,E as toOrderId,G as toPaginationCursor,F as toPartnerId,H as toPositionId,I as toQuestionId,J as toResolutionRequestId,K as toRfqId,L as toRfqQuoteId,M as toRfqRequestorPublicId,N as toSeriesId,O as toSportId,P as toTagId,Q as toTeamId,R as toTemplateId,T as toTokenId,S as toTransactionId,j as toUuid}from'./chunk-JPPG656Y.js';import {z}from'zod';var s=(i=>(i.InvalidCursor="invalid_cursor",i.InvalidQueryParam="invalid_query_param",i.InvalidPathParam="invalid_path_param",i.InvalidRequestBody="invalid_request_body",i.InsufficientLiquidity="insufficient_liquidity",i.InvalidApiKey="invalid_api_key",i.InvalidCredentials="invalid_credentials",i.LoginRejected="login_rejected",i.InvalidOrderTokenId="invalid_order_token_id",i.InvalidOrderPrice="invalid_order_price",i.InvalidBuilderCode="invalid_builder_code",i.InvalidOrderExpiration="invalid_order_expiration",i.InvalidOrderAmount="invalid_order_amount",i.InvalidOrderIdentity="invalid_order_identity",i.OrderTooSmall="order_too_small",i.InvalidClobCredentials="invalid_clob_credentials",i.PayloadTooLarge="payload_too_large",i.InvalidBuilderCredentials="invalid_builder_credentials",i.UpstreamUnavailable="upstream_unavailable",i.RateLimited="rate_limited",i.SubmissionOutcomeUnknown="submission_outcome_unknown",i.CancelOutcomeUnknown="cancel_outcome_unknown",i.RfqOutcomeUnknown="rfq_outcome_unknown",i.BuilderAttributionUnsupported="builder_attribution_unsupported",i.RestrictedRegionCloseOnly="restricted_region_close_only",i.NotFound="not_found",i.EventArchived="event_archived",i.MarketNotFound="market_not_found",i.DepositWalletNotFound="deposit_wallet_not_found",i.InvalidTransaction="invalid_transaction",i.TransactionNotAllowed="transaction_not_allowed",i.DuplicateInFlightNonce="duplicate_in_flight_nonce",i.InternalError="internal_error",i.InvalidAccessToken="invalid_access_token",i.ExpiredAccessToken="expired_access_token",i.ApiKeyMismatch="api_key_mismatch",i.IdentityProviderUnavailable="identity_provider_unavailable",i.IdentityProviderProtocolError="identity_provider_protocol_error",i.InvalidSigner="invalid_signer",i.InvalidSignature="invalid_signature",i.MalformedRefreshToken="malformed_refresh_token",i.ChallengeNotFound="challenge_not_found",i.ChallengeExpired="challenge_expired",i.InvalidAttestation="invalid_attestation",i.InvalidRefreshToken="invalid_refresh_token",i.ChallengeConsumed="challenge_consumed",i.InvalidWallet="invalid_wallet",i.WalletNotAuthorized="wallet_not_authorized",i))(s||{}),_=z.number().finite().nonnegative().nullish().transform(l=>l??void 0),d=z.object({code:z.string().min(1).transform(l=>l),message:z.string().min(1),retry_after_seconds:_}).transform(({code:l,message:t,retry_after_seconds:n})=>({code:l,message:t,retryAfter:n})),c=z.object({error:z.string().min(1),code:z.string().nullish(),retry_after_seconds:_}).transform(({error:l,code:t,retry_after_seconds:n})=>({message:l,code:t||void 0,retryAfter:n})),_e=z.union([c,d]);export{_e as ErrorResponseSchema,d as GatewayErrorResponseSchema,s as GatewayKnownErrorCode,c as PassthroughErrorResponseSchema};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts"],"names":["GatewayKnownErrorCode","RetryAfterSecondsSchema","z","value","GatewayErrorResponseSchema","code","message","retry_after_seconds","PassthroughErrorResponseSchema","error","ErrorResponseSchema"],"mappings":"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","file":"index.js","sourcesContent":["import { z } from 'zod';\n\n/** Known rejection codes; unknown future codes remain valid. */\nexport enum GatewayKnownErrorCode {\n InvalidCursor = 'invalid_cursor',\n InvalidQueryParam = 'invalid_query_param',\n InvalidPathParam = 'invalid_path_param',\n InvalidRequestBody = 'invalid_request_body',\n InsufficientLiquidity = 'insufficient_liquidity',\n InvalidApiKey = 'invalid_api_key',\n InvalidCredentials = 'invalid_credentials',\n LoginRejected = 'login_rejected',\n InvalidOrderTokenId = 'invalid_order_token_id',\n InvalidOrderPrice = 'invalid_order_price',\n InvalidBuilderCode = 'invalid_builder_code',\n InvalidOrderExpiration = 'invalid_order_expiration',\n InvalidOrderAmount = 'invalid_order_amount',\n InvalidOrderIdentity = 'invalid_order_identity',\n OrderTooSmall = 'order_too_small',\n InvalidClobCredentials = 'invalid_clob_credentials',\n PayloadTooLarge = 'payload_too_large',\n InvalidBuilderCredentials = 'invalid_builder_credentials',\n UpstreamUnavailable = 'upstream_unavailable',\n RateLimited = 'rate_limited',\n SubmissionOutcomeUnknown = 'submission_outcome_unknown',\n CancelOutcomeUnknown = 'cancel_outcome_unknown',\n RfqOutcomeUnknown = 'rfq_outcome_unknown',\n BuilderAttributionUnsupported = 'builder_attribution_unsupported',\n RestrictedRegionCloseOnly = 'restricted_region_close_only',\n NotFound = 'not_found',\n EventArchived = 'event_archived',\n MarketNotFound = 'market_not_found',\n DepositWalletNotFound = 'deposit_wallet_not_found',\n InvalidTransaction = 'invalid_transaction',\n TransactionNotAllowed = 'transaction_not_allowed',\n DuplicateInFlightNonce = 'duplicate_in_flight_nonce',\n InternalError = 'internal_error',\n InvalidAccessToken = 'invalid_access_token',\n ExpiredAccessToken = 'expired_access_token',\n ApiKeyMismatch = 'api_key_mismatch',\n IdentityProviderUnavailable = 'identity_provider_unavailable',\n IdentityProviderProtocolError = 'identity_provider_protocol_error',\n InvalidSigner = 'invalid_signer',\n InvalidSignature = 'invalid_signature',\n MalformedRefreshToken = 'malformed_refresh_token',\n ChallengeNotFound = 'challenge_not_found',\n ChallengeExpired = 'challenge_expired',\n InvalidAttestation = 'invalid_attestation',\n InvalidRefreshToken = 'invalid_refresh_token',\n ChallengeConsumed = 'challenge_consumed',\n InvalidWallet = 'invalid_wallet',\n WalletNotAuthorized = 'wallet_not_authorized',\n}\n\n/** A known rejection code or an unrecognized code returned by the server. */\nexport type GatewayErrorCode = GatewayKnownErrorCode | (string & {});\n\n// Nullable optional hints carry no value; keep the error envelope usable.\nconst RetryAfterSecondsSchema = z\n .number()\n .finite()\n .nonnegative()\n .nullish()\n .transform((value) => value ?? undefined);\n\n/** Native error envelope, retaining unrecognized codes for forward compatibility. */\nexport const GatewayErrorResponseSchema = z\n .object({\n code: z\n .string()\n .min(1)\n .transform((code): GatewayErrorCode => code),\n message: z.string().min(1),\n retry_after_seconds: RetryAfterSecondsSchema,\n })\n .transform(({ code, message, retry_after_seconds }) => ({\n code,\n message,\n retryAfter: retry_after_seconds,\n }));\n\n/** Upstream error envelope normalized to the transport's error fields. */\nexport const PassthroughErrorResponseSchema = z\n .object({\n error: z.string().min(1),\n code: z.string().nullish(),\n retry_after_seconds: RetryAfterSecondsSchema,\n })\n .transform(({ error, code, retry_after_seconds }) => ({\n message: error,\n code: code || undefined,\n retryAfter: retry_after_seconds,\n }));\n\n// Preserve upstream error/retry precedence for responses containing both shapes.\nexport const ErrorResponseSchema = z.union([\n PassthroughErrorResponseSchema,\n GatewayErrorResponseSchema,\n]);\n"]}
|