@polymarket/client 0.1.0-beta.15 → 0.1.0-beta.17

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.
@@ -1,2 +0,0 @@
1
- import {PolymarketError}from'@polymarket/types';var t=class e extends PolymarketError{name="TransportError";constructor(r,s={}){super(r,s);}static fromError(r){return new e(r instanceof Error?r.message:"Request failed",{cause:r})}};var n=class extends PolymarketError{name="TimeoutError";constructor(r,s={}){super(r,s);}},a=class extends PolymarketError{name="TransactionFailedError";constructor(r,s={}){super(r,s);}},c=class e extends PolymarketError{name="CancelledSigningError";constructor(r,s={}){super(r,s);}static fromError(r){return new e(r.message,{cause:r})}};var i=class e extends PolymarketError{name="SigningError";constructor(r,s={}){super(r,s);}static fromError(r,s){let u=s??(r instanceof Error?r.message:"Signing failed");return new e(u,{cause:r})}};export{t as a,n as b,a as c,c as d,i as e};//# sourceMappingURL=chunk-NTEPEJZK.js.map
2
- //# sourceMappingURL=chunk-NTEPEJZK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/errors.ts"],"names":["TransportError","_TransportError","PolymarketError","message","options","error","TimeoutError","TransactionFailedError","CancelledSigningError","_CancelledSigningError","SigningError","_SigningError","msg"],"mappings":"gDAmDO,IAAMA,EAAN,MAAMC,CAAAA,SAAuBC,eAAgB,CACzC,KAAO,gBAAA,CAEhB,WAAA,CAAYC,CAAAA,CAAiBC,CAAAA,CAAwB,EAAC,CAAG,CACvD,KAAA,CAAMD,CAAAA,CAASC,CAAO,EACxB,CAEA,OAAO,SAAA,CAAUC,EAAgC,CAC/C,OAAO,IAAIJ,CAAAA,CACTI,aAAiB,KAAA,CAAQA,CAAAA,CAAM,OAAA,CAAU,gBAAA,CACzC,CACE,KAAA,CAAOA,CACT,CACF,CACF,CACF,EAmCO,IAAMC,CAAAA,CAAN,cAA2BJ,eAAgB,CACvC,IAAA,CAAO,cAAA,CAEhB,YAAYC,CAAAA,CAAiBC,CAAAA,CAAwB,EAAC,CAAG,CACvD,KAAA,CAAMD,CAAAA,CAASC,CAAO,EACxB,CACF,CAAA,CAKaG,CAAAA,CAAN,cAAqCL,eAAgB,CACjD,IAAA,CAAO,wBAAA,CAEhB,WAAA,CAAYC,CAAAA,CAAiBC,EAAwB,EAAC,CAAG,CACvD,KAAA,CAAMD,EAASC,CAAO,EACxB,CACF,CAAA,CAKaI,CAAAA,CAAN,MAAMC,CAAAA,SAA8BP,eAAgB,CAChD,IAAA,CAAO,uBAAA,CAEhB,WAAA,CAAYC,CAAAA,CAAiBC,EAAwB,EAAC,CAAG,CACvD,KAAA,CAAMD,EAASC,CAAO,EACxB,CAEA,OAAO,UAAUC,CAAAA,CAAqC,CACpD,OAAO,IAAII,EAAsBJ,CAAAA,CAAM,OAAA,CAAS,CAC9C,KAAA,CAAOA,CACT,CAAC,CACH,CACF,MAkBaK,CAAAA,CAAN,MAAMC,CAAAA,SAAqBT,eAAgB,CACvC,IAAA,CAAO,cAAA,CAEhB,WAAA,CAAYC,CAAAA,CAAiBC,EAAwB,EAAC,CAAG,CACvD,KAAA,CAAMD,EAASC,CAAO,EACxB,CAEA,OAAO,UAAUC,CAAAA,CAAgBF,CAAAA,CAAgC,CAC/D,IAAMS,EACJT,CAAAA,GAAYE,CAAAA,YAAiB,KAAA,CAAQA,CAAAA,CAAM,QAAU,gBAAA,CAAA,CACvD,OAAO,IAAIM,CAAAA,CAAaC,EAAK,CAAE,KAAA,CAAOP,CAAM,CAAC,CAC/C,CACF","file":"chunk-NTEPEJZK.js","sourcesContent":["import { PolymarketError } from '@polymarket/types';\nimport type { ZodError } from 'zod';\nimport {\n formatInputZodError,\n formatResponseZodError,\n type ResponseValidationContext,\n} from './validation';\n\n/**\n * Error thrown when an action input fails SDK validation before a request is\n * sent.\n */\nexport class UserInputError extends PolymarketError {\n override name = 'UserInputError' as const;\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n }\n\n static fromZodError(error: ZodError): UserInputError {\n return new UserInputError(formatInputZodError(error), {\n cause: error,\n });\n }\n}\n\n/**\n * Error thrown when a service response does not match the action's expected\n * response shape.\n */\nexport class UnexpectedResponseError extends PolymarketError {\n override name = 'UnexpectedResponseError' as const;\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n }\n\n static fromZodError(\n error: ZodError,\n context: ResponseValidationContext,\n ): UnexpectedResponseError {\n return new UnexpectedResponseError(formatResponseZodError(error, context), {\n cause: error,\n });\n }\n}\n\n/**\n * Error thrown when the SDK cannot complete a request because of a network or\n * runtime transport failure.\n */\nexport class TransportError extends PolymarketError {\n override name = 'TransportError' as const;\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n }\n\n static fromError(error: unknown): TransportError {\n return new TransportError(\n error instanceof Error ? error.message : 'Request failed',\n {\n cause: error,\n },\n );\n }\n}\n\nexport type RequestRejectedErrorOptions = {\n status: number;\n};\n\n/**\n * Error thrown when a service responds with a non-success status other than\n * rate limiting.\n */\nexport class RequestRejectedError extends PolymarketError {\n override name = 'RequestRejectedError' as const;\n\n readonly status: number;\n\n constructor(\n message: string,\n options: ErrorOptions & RequestRejectedErrorOptions,\n ) {\n super(message, options);\n this.status = options.status;\n }\n}\n\n/**\n * Error thrown when the service rejects a request because the rate limit has\n * been exceeded.\n */\nexport class RateLimitError extends PolymarketError {\n override name = 'RateLimitError' as const;\n}\n\n/**\n * Error thrown when an async wait operation exceeds its allotted polling time.\n */\nexport class TimeoutError extends PolymarketError {\n override name = 'TimeoutError' as const;\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n }\n}\n\n/**\n * Error thrown when a submitted transaction reaches a terminal failure state.\n */\nexport class TransactionFailedError extends PolymarketError {\n override name = 'TransactionFailedError' as const;\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n }\n}\n\n/**\n * Error thrown when the user cancels a required wallet signing action.\n */\nexport class CancelledSigningError extends PolymarketError {\n override name = 'CancelledSigningError' as const;\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n }\n\n static fromError(error: Error): CancelledSigningError {\n return new CancelledSigningError(error.message, {\n cause: error,\n });\n }\n}\n\n/**\n * Error thrown when there is not enough resting market liquidity to satisfy the\n * requested execution semantics.\n */\nexport class InsufficientLiquidityError extends PolymarketError {\n override name = 'InsufficientLiquidityError' as const;\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n }\n}\n\n/**\n * Error thrown when the SDK cannot produce a required signature or\n * authentication payload.\n */\nexport class SigningError extends PolymarketError {\n override name = 'SigningError' as const;\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n }\n\n static fromError(error: unknown, message?: string): SigningError {\n const msg =\n message ?? (error instanceof Error ? error.message : 'Signing failed');\n return new SigningError(msg, { cause: error });\n }\n}\n\nexport function makeErrorGuard<\n // biome-ignore lint/suspicious/noExplicitAny: constructor rest args require any[]\n TClasses extends ReadonlyArray<new (...args: any[]) => unknown>,\n>(\n ...classes: TClasses\n): { isError(error: unknown): error is InstanceType<TClasses[number]> } {\n return {\n isError(error: unknown): error is InstanceType<TClasses[number]> {\n return classes.some((c) => error instanceof c);\n },\n };\n}\n"]}