@avalabs/fusion-sdk 0.24.0 → 0.25.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/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +18 -1
- package/dist/errors.d.ts +18 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/transfer-service/markr/_schema.cjs +1 -1
- package/dist/transfer-service/markr/_schema.cjs.map +1 -1
- package/dist/transfer-service/markr/_schema.js +1 -1
- package/dist/transfer-service/markr/_schema.js.map +1 -1
- package/dist/transfer-service/markr/_utils.cjs +1 -1
- package/dist/transfer-service/markr/_utils.cjs.map +1 -1
- package/dist/transfer-service/markr/_utils.js +1 -1
- package/dist/transfer-service/markr/_utils.js.map +1 -1
- package/dist/transfer-service/markr/recurring/_api.cjs +1 -1
- package/dist/transfer-service/markr/recurring/_api.cjs.map +1 -1
- package/dist/transfer-service/markr/recurring/_api.js +1 -1
- package/dist/transfer-service/markr/recurring/_api.js.map +1 -1
- package/dist/transfer-service/markr/recurring/_chain-info.cjs +1 -1
- package/dist/transfer-service/markr/recurring/_chain-info.cjs.map +1 -1
- package/dist/transfer-service/markr/recurring/_chain-info.js +1 -1
- package/dist/transfer-service/markr/recurring/_chain-info.js.map +1 -1
- package/dist/transfer-service/markr/recurring/_eligibility.cjs +1 -1
- package/dist/transfer-service/markr/recurring/_eligibility.cjs.map +1 -1
- package/dist/transfer-service/markr/recurring/_eligibility.js +1 -1
- package/dist/transfer-service/markr/recurring/_eligibility.js.map +1 -1
- package/dist/transfer-service/markr/recurring/_namespace.cjs +1 -1
- package/dist/transfer-service/markr/recurring/_namespace.cjs.map +1 -1
- package/dist/transfer-service/markr/recurring/_namespace.js +1 -1
- package/dist/transfer-service/markr/recurring/_namespace.js.map +1 -1
- package/dist/transfer-service/markr/recurring/_schema.cjs +1 -1
- package/dist/transfer-service/markr/recurring/_schema.cjs.map +1 -1
- package/dist/transfer-service/markr/recurring/_schema.js +1 -1
- package/dist/transfer-service/markr/recurring/_schema.js.map +1 -1
- package/dist/transfer-service/markr/recurring/types.cjs +1 -1
- package/dist/transfer-service/markr/recurring/types.cjs.map +1 -1
- package/dist/transfer-service/markr/recurring/types.d.cts +32 -23
- package/dist/transfer-service/markr/recurring/types.d.ts +32 -23
- package/dist/transfer-service/markr/recurring/types.js +1 -1
- package/dist/transfer-service/markr/recurring/types.js.map +1 -1
- package/package.json +3 -3
package/dist/errors.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
let e=function(e){return e[e.NOT_IMPLEMENTED=5e3]=`NOT_IMPLEMENTED`,e[e.SERVICE_NOT_AVAILABLE=5001]=`SERVICE_NOT_AVAILABLE`,e[e.INITIALIZATION_FAILED=5002]=`INITIALIZATION_FAILED`,e[e.INVALID_PARAMS=5003]=`INVALID_PARAMS`,e[e.TIMEOUT=5004]=`TIMEOUT`,e[e.VIEM_ERROR=5005]=`VIEM_ERROR`,e[e.TRANSACTION_REVERTED=5006]=`TRANSACTION_REVERTED`,e[e.NOTARIZATION_FAILED=5007]=`NOTARIZATION_FAILED`,e[e.SIGNING_FAILED=5008]=`SIGNING_FAILED`,e[e.SOLANA_ERROR=5009]=`SOLANA_ERROR`,e[e.HL_WITHDRAWABLE_DROPPED=5010]=`HL_WITHDRAWABLE_DROPPED`,e[e.HL_UNSUPPORTED_PROTOCOL_VERSION=5011]=`HL_UNSUPPORTED_PROTOCOL_VERSION`,e[e.HL_EXCHANGE_REJECTED=5012]=`HL_EXCHANGE_REJECTED`,e[e.UNKNOWN=5999]=`UNKNOWN`,e}({}),t=function(e){return e.ASSET_NOT_SUPPORTED=`ASSET_NOT_SUPPORTED`,e.CHAIN_NOT_SUPPORTED=`CHAIN_NOT_SUPPORTED`,e.CONFIG_NOT_AVAILABLE=`CONFIG_NOT_AVAILABLE`,e.CONFIRMATION_COUNT_UNKNOWN=`CONFIRMATION_COUNT_UNKNOWN`,e.DUPLICATE_SERVICE_INITIALIZATION=`DUPLICATE_SERVICE_INITIALIZATION`,e.ENVIRONMENT_NOT_SUPPORTED=`ENVIRONMENT_NOT_SUPPORTED`,e.IDENTICAL_CHAINS_PROVIDED=`IDENTICAL_CHAINS_PROVIDED`,e.INCORRECT_ADDRESS_PROVIDED=`INCORRECT_ADDRESS_PROVIDED`,e.INCORRECT_AMOUNT_PROVIDED=`INCORRECT_AMOUNT_PROVIDED`,e.INCORRECT_HASH_PROVIDED=`INCORRECT_HASH_PROVIDED`,e.INCORRECT_PROVIDER_PROVIDED=`INCORRECT_PROVIDER_PROVIDED`,e.INCORRECT_SIGNER_PROVIDED=`INCORRECT_SIGNER_PROVIDED`,e.INCORRECT_TXHASH_PROVIDED=`INCORRECT_TXHASH_PROVIDED`,e.INVALID_PARAMS=`INVALID_PARAMS`,e.SERVICE_TYPE_NOT_CONFIGURED=`SERVICE_TYPE_NOT_CONFIGURED`,e.UNKNOWN=`UNKNOWN`,e.VULNERABLE_TOKEN_APPROVAL_ADDRESS=`VULNERABLE_TOKEN_APPROVAL_ADDRESS`,e.WARDEN_CONFIG_MISMATCH=`WARDEN_CONFIG_MISMATCH`,e.WARDEN_CONFIG_MISSING_NETWORK=`WARDEN_CONFIG_MISSING_NETWORK`,e.ADDRESS_IS_BLOCKED=`ADDRESS_IS_BLOCKED`,e.QUOTE_EXPIRED=`QUOTE_EXPIRED`,e}({});var n=class extends Error{name=`SdkError`;constructor(e,t,n){super(e,{cause:n?.cause}),this.code=t,this.options=n}walk(e){return r(this,e)}};function r(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?r(e.cause,t):t?null:e}function i(e){return e instanceof n}var a=class extends Error{name=`HttpError`;status;statusText;response;data;constructor(e,t,n){super(e),this.name=`HttpError`,this.status=t.status,this.statusText=t.statusText,this.response=t,this.data=n}};function o(e){return e instanceof a}var s=class extends Error{name=`TimeoutError`;constructor(e=`Request timed out.`){super(e),this.name=`TimeoutError`}};function c(e){return e instanceof s}var l=class extends Error{name=`AbortedError`;constructor(e=`Operation was aborted.`){super(e),this.name=`AbortedError`}};function u(e){return e instanceof l}var d=class extends Error{name=`ResponseValidationError`;issues;rawResponse;constructor(e=`Response validation failed.`,t,n){super(e),this.name=`ResponseValidationError`,this.issues=t,this.rawResponse=n}};function f(e){return e instanceof d}var p=class extends n{name=`ServiceInitializationError`;constructor(n=t.UNKNOWN,r,i){super(n,e.INITIALIZATION_FAILED,{cause:i,details:r})}};function m(e){return e instanceof p}var h=class extends n{name=`ServiceUnavailableError`;constructor(n=t.UNKNOWN,r){super(n,e.SERVICE_NOT_AVAILABLE,{details:r})}};function g(e){return e instanceof h}var _=class extends n{name=`InsufficientFundsError`;insufficientTokenWasNative;constructor({cause:e,details:t,errorCode:n,insufficientTokenWasNative:r}){super(r?`Insufficient native funds to cover the fee.`:`Insufficient token funds to estimate the fee.`,n,{cause:e,details:t}),this.insufficientTokenWasNative=r}};function v(e){return e instanceof _}var y=class extends n{name=`EstimateNativeFeeError`;details;tx;constructor({cause:e,details:t,errorCode:n,message:r=`Failed to estimate native fee for quote.`,tx:i}){super(r,n,{cause:e}),this.details=t,this.tx=i}causedByInsufficientFunds(){return v(this.cause)}};function b(e){return e instanceof y}var x=class extends n{name=`InvalidParamsError`;constructor(n=t.INVALID_PARAMS,r){super(n,e.INVALID_PARAMS,{details:r})}};function S(e){return e instanceof x}var C=class extends n{constructor(){super(`This functionality is not yet implemented.`,e.NOT_IMPLEMENTED)}};exports.AbortedError=l,exports.ErrorCode=e,exports.ErrorReason=t,exports.EstimateNativeFeeError=y,exports.HttpError=a,exports.InsufficientFundsError=_,exports.InvalidParamsError=x,exports.NotImplementedError=C,exports.ResponseValidationError=d,exports.SdkError=n,exports.ServiceInitializationError=p,exports.ServiceUnavailableError=h,exports.TimeoutError=s,exports.isAbortedError=u,exports.isEstimateNativeFeeError=b,exports.isHttpError=o,exports.isInsufficientFundsError=v,exports.isInvalidParamsError=S,exports.isResponseValidationError=f,exports.isSdkError=i,exports.isServiceInitializationError=m,exports.isServiceUnavailableError=g,exports.isTimeoutError=c;
|
|
1
|
+
let e=function(e){return e[e.NOT_IMPLEMENTED=5e3]=`NOT_IMPLEMENTED`,e[e.SERVICE_NOT_AVAILABLE=5001]=`SERVICE_NOT_AVAILABLE`,e[e.INITIALIZATION_FAILED=5002]=`INITIALIZATION_FAILED`,e[e.INVALID_PARAMS=5003]=`INVALID_PARAMS`,e[e.TIMEOUT=5004]=`TIMEOUT`,e[e.VIEM_ERROR=5005]=`VIEM_ERROR`,e[e.TRANSACTION_REVERTED=5006]=`TRANSACTION_REVERTED`,e[e.NOTARIZATION_FAILED=5007]=`NOTARIZATION_FAILED`,e[e.SIGNING_FAILED=5008]=`SIGNING_FAILED`,e[e.SOLANA_ERROR=5009]=`SOLANA_ERROR`,e[e.HL_WITHDRAWABLE_DROPPED=5010]=`HL_WITHDRAWABLE_DROPPED`,e[e.HL_UNSUPPORTED_PROTOCOL_VERSION=5011]=`HL_UNSUPPORTED_PROTOCOL_VERSION`,e[e.HL_EXCHANGE_REJECTED=5012]=`HL_EXCHANGE_REJECTED`,e[e.UNKNOWN=5999]=`UNKNOWN`,e}({}),t=function(e){return e.ASSET_NOT_SUPPORTED=`ASSET_NOT_SUPPORTED`,e.CHAIN_NOT_SUPPORTED=`CHAIN_NOT_SUPPORTED`,e.CONFIG_NOT_AVAILABLE=`CONFIG_NOT_AVAILABLE`,e.CONFIRMATION_COUNT_UNKNOWN=`CONFIRMATION_COUNT_UNKNOWN`,e.DUPLICATE_SERVICE_INITIALIZATION=`DUPLICATE_SERVICE_INITIALIZATION`,e.ENVIRONMENT_NOT_SUPPORTED=`ENVIRONMENT_NOT_SUPPORTED`,e.IDENTICAL_CHAINS_PROVIDED=`IDENTICAL_CHAINS_PROVIDED`,e.INCORRECT_ADDRESS_PROVIDED=`INCORRECT_ADDRESS_PROVIDED`,e.INCORRECT_AMOUNT_PROVIDED=`INCORRECT_AMOUNT_PROVIDED`,e.INCORRECT_HASH_PROVIDED=`INCORRECT_HASH_PROVIDED`,e.INCORRECT_PROVIDER_PROVIDED=`INCORRECT_PROVIDER_PROVIDED`,e.INCORRECT_SIGNER_PROVIDED=`INCORRECT_SIGNER_PROVIDED`,e.INCORRECT_TXHASH_PROVIDED=`INCORRECT_TXHASH_PROVIDED`,e.INVALID_PARAMS=`INVALID_PARAMS`,e.SERVICE_TYPE_NOT_CONFIGURED=`SERVICE_TYPE_NOT_CONFIGURED`,e.UNKNOWN=`UNKNOWN`,e.VULNERABLE_TOKEN_APPROVAL_ADDRESS=`VULNERABLE_TOKEN_APPROVAL_ADDRESS`,e.WARDEN_CONFIG_MISMATCH=`WARDEN_CONFIG_MISMATCH`,e.WARDEN_CONFIG_MISSING_NETWORK=`WARDEN_CONFIG_MISSING_NETWORK`,e.ADDRESS_IS_BLOCKED=`ADDRESS_IS_BLOCKED`,e.QUOTE_EXPIRED=`QUOTE_EXPIRED`,e.NATIVE_WRAP_REVERTED=`NATIVE_WRAP_REVERTED`,e.RECURRING_SWAP_RESPONSE_INCONSISTENT=`RECURRING_SWAP_RESPONSE_INCONSISTENT`,e}({});var n=class extends Error{name=`SdkError`;constructor(e,t,n){super(e,{cause:n?.cause}),this.code=t,this.options=n}walk(e){return r(this,e)}};function r(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?r(e.cause,t):t?null:e}function i(e){return e instanceof n}var a=class extends Error{name=`HttpError`;status;statusText;response;data;constructor(e,t,n){super(e),this.name=`HttpError`,this.status=t.status,this.statusText=t.statusText,this.response=t,this.data=n}};function o(e){return e instanceof a}var s=class extends Error{name=`TimeoutError`;constructor(e=`Request timed out.`){super(e),this.name=`TimeoutError`}};function c(e){return e instanceof s}var l=class extends Error{name=`AbortedError`;constructor(e=`Operation was aborted.`){super(e),this.name=`AbortedError`}};function u(e){return e instanceof l}var d=class extends Error{name=`ResponseValidationError`;issues;rawResponse;constructor(e=`Response validation failed.`,t,n){super(e),this.name=`ResponseValidationError`,this.issues=t,this.rawResponse=n}};function f(e){return e instanceof d}var p=class extends n{name=`ServiceInitializationError`;constructor(n=t.UNKNOWN,r,i){super(n,e.INITIALIZATION_FAILED,{cause:i,details:r})}};function m(e){return e instanceof p}var h=class extends n{name=`ServiceUnavailableError`;constructor(n=t.UNKNOWN,r){super(n,e.SERVICE_NOT_AVAILABLE,{details:r})}};function g(e){return e instanceof h}var _=class extends n{name=`InsufficientFundsError`;insufficientTokenWasNative;constructor({cause:e,details:t,errorCode:n,insufficientTokenWasNative:r}){super(r?`Insufficient native funds to cover the fee.`:`Insufficient token funds to estimate the fee.`,n,{cause:e,details:t}),this.insufficientTokenWasNative=r}};function v(e){return e instanceof _}var y=class extends n{name=`EstimateNativeFeeError`;details;tx;constructor({cause:e,details:t,errorCode:n,message:r=`Failed to estimate native fee for quote.`,tx:i}){super(r,n,{cause:e}),this.details=t,this.tx=i}causedByInsufficientFunds(){return v(this.cause)}};function b(e){return e instanceof y}var x=class extends n{name=`InvalidParamsError`;constructor(n=t.INVALID_PARAMS,r){super(n,e.INVALID_PARAMS,{details:r})}};function S(e){return e instanceof x}var C=class extends n{constructor(){super(`This functionality is not yet implemented.`,e.NOT_IMPLEMENTED)}};exports.AbortedError=l,exports.ErrorCode=e,exports.ErrorReason=t,exports.EstimateNativeFeeError=y,exports.HttpError=a,exports.InsufficientFundsError=_,exports.InvalidParamsError=x,exports.NotImplementedError=C,exports.ResponseValidationError=d,exports.SdkError=n,exports.ServiceInitializationError=p,exports.ServiceUnavailableError=h,exports.TimeoutError=s,exports.isAbortedError=u,exports.isEstimateNativeFeeError=b,exports.isHttpError=o,exports.isInsufficientFundsError=v,exports.isInvalidParamsError=S,exports.isResponseValidationError=f,exports.isSdkError=i,exports.isServiceInitializationError=m,exports.isServiceUnavailableError=g,exports.isTimeoutError=c;
|
|
2
2
|
//# sourceMappingURL=errors.cjs.map
|
package/dist/errors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export enum ErrorCode {\n NOT_IMPLEMENTED = 5_000,\n SERVICE_NOT_AVAILABLE = 5_001,\n INITIALIZATION_FAILED = 5_002,\n INVALID_PARAMS = 5_003,\n TIMEOUT = 5_004,\n VIEM_ERROR = 5_005,\n TRANSACTION_REVERTED = 5_006,\n NOTARIZATION_FAILED = 5_007,\n SIGNING_FAILED = 5_008,\n SOLANA_ERROR = 5_009,\n /** Hyperliquid `withdrawable` dropped below the requested amount between authorize and sendAsset. */\n HL_WITHDRAWABLE_DROPPED = 5_010,\n /** Markr's `/swap` returned an `hyperliquid-withdraw` variant whose `protocolVersion` is unknown to this SDK release. */\n HL_UNSUPPORTED_PROTOCOL_VERSION = 5_011,\n /** Hyperliquid `/exchange` returned `{ status: \"err\" }`. */\n HL_EXCHANGE_REJECTED = 5_012,\n UNKNOWN = 5_999,\n}\n\nexport enum ErrorReason {\n /** the provided asset is not supported by the bridge */\n ASSET_NOT_SUPPORTED = 'ASSET_NOT_SUPPORTED',\n /** the provided source or target chain is not supported by the bridge */\n CHAIN_NOT_SUPPORTED = 'CHAIN_NOT_SUPPORTED',\n /** error while fetching or parsing the config */\n CONFIG_NOT_AVAILABLE = 'CONFIG_NOT_AVAILABLE',\n /** required confirmation count of the source or target chain is unknown */\n CONFIRMATION_COUNT_UNKNOWN = 'CONFIRMATION_COUNT_UNKNOWN',\n /** service is being initialized more than once */\n DUPLICATE_SERVICE_INITIALIZATION = 'DUPLICATE_SERVICE_INITIALIZATION',\n /** bridge does not support specified environment */\n ENVIRONMENT_NOT_SUPPORTED = 'ENVIRONMENT_NOT_SUPPORTED',\n /** provided source and target chains are the same */\n IDENTICAL_CHAINS_PROVIDED = 'IDENTICAL_CHAINS_PROVIDED',\n /** the sender or recipient address is incorrect */\n INCORRECT_ADDRESS_PROVIDED = 'INCORRECT_ADDRESS_PROVIDED',\n /** the transfer amount is incorrect (e.g.: lesser than or equal to zero) */\n INCORRECT_AMOUNT_PROVIDED = 'INCORRECT_AMOUNT_PROVIDED',\n /** the transaction is not hex */\n INCORRECT_HASH_PROVIDED = 'INCORRECT_HASH_PROVIDED',\n /** The provided provider is incorrect type (Provider VS BitcoinProvider) */\n INCORRECT_PROVIDER_PROVIDED = 'INCORRECT_PROVIDER_PROVIDED',\n /** The provided signer is incorrect type */\n INCORRECT_SIGNER_PROVIDED = 'INCORRECT_SIGNER_PROVIDED',\n /** the sourceTxHash or targetTxHash is incorrect */\n INCORRECT_TXHASH_PROVIDED = 'INCORRECT_TXHASH_PROVIDED',\n /** generic error with the params */\n INVALID_PARAMS = 'INVALID_PARAMS',\n /** ServiceType requested not available */\n SERVICE_TYPE_NOT_CONFIGURED = 'SERVICE_TYPE_NOT_CONFIGURED',\n /** generic, not specified error */\n UNKNOWN = 'UNKNOWN',\n /** error when the address has token approvals for addresses involved in the multichain incident */\n VULNERABLE_TOKEN_APPROVAL_ADDRESS = 'VULNERABLE_TOKEN_APPROVAL_ADDRESS',\n /** error when warden config was not found or it is over the mismatch threshold */\n WARDEN_CONFIG_MISMATCH = 'WARDEN_CONFIG_MISMATCH',\n /** fetched warden config does not contain network IDs */\n WARDEN_CONFIG_MISSING_NETWORK = 'WARDEN_CONFIG_MISSING_NETWORK',\n /** address is blocked */\n ADDRESS_IS_BLOCKED = 'ADDRESS_IS_BLOCKED',\n /** Quote expired */\n QUOTE_EXPIRED = 'QUOTE_EXPIRED',\n}\n\nexport class SdkError extends Error {\n override name = 'SdkError';\n\n constructor(\n message: string,\n public code: ErrorCode,\n public options?: {\n cause?: unknown;\n details?: string;\n },\n ) {\n super(message, { cause: options?.cause });\n }\n\n walk(): Error;\n walk(fn: (err: unknown) => boolean): Error | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walk(fn?: any): any {\n return walkError(this, fn);\n }\n}\n\nfunction walkError(err: unknown): unknown;\nfunction walkError(err: unknown, fn: (err: unknown) => boolean): unknown | null;\nfunction walkError(err: unknown, fn?: ((err: unknown) => boolean) | undefined): unknown | null;\nfunction walkError(err: unknown, fn?: ((err: unknown) => boolean) | undefined): unknown | null {\n if (fn?.(err)) {\n return err;\n }\n\n if (err && typeof err === 'object' && 'cause' in err && err.cause !== undefined) {\n return walkError(err.cause, fn);\n }\n\n return fn ? null : err;\n}\n\nexport function isSdkError(error: unknown): error is SdkError {\n return error instanceof SdkError;\n}\n\nexport class HttpError extends Error {\n override name = 'HttpError';\n\n readonly status: number;\n readonly statusText: string;\n readonly response: Response;\n readonly data?: unknown;\n\n constructor(message: string, response: Response, data?: unknown) {\n super(message);\n this.name = 'HttpError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.response = response;\n this.data = data;\n }\n}\n\nexport function isHttpError(error: unknown): error is HttpError {\n return error instanceof HttpError;\n}\n\nexport class TimeoutError extends Error {\n override name = 'TimeoutError';\n\n constructor(message = 'Request timed out.') {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n\nexport function isTimeoutError(error: unknown): error is TimeoutError {\n return error instanceof TimeoutError;\n}\n\nexport class AbortedError extends Error {\n override name = 'AbortedError';\n\n constructor(message = 'Operation was aborted.') {\n super(message);\n this.name = 'AbortedError';\n }\n}\n\nexport function isAbortedError(error: unknown): error is AbortedError {\n return error instanceof AbortedError;\n}\n\nexport class ResponseValidationError extends Error {\n override name = 'ResponseValidationError';\n\n readonly issues?: unknown;\n readonly rawResponse?: unknown;\n\n constructor(message = 'Response validation failed.', issues?: unknown, rawResponse?: unknown) {\n super(message);\n this.name = 'ResponseValidationError';\n this.issues = issues;\n this.rawResponse = rawResponse;\n }\n}\n\nexport function isResponseValidationError(error: unknown): error is ResponseValidationError {\n return error instanceof ResponseValidationError;\n}\n\nexport class ServiceInitializationError extends SdkError {\n override name = 'ServiceInitializationError';\n\n constructor(message: string = ErrorReason.UNKNOWN, details?: string, cause?: unknown) {\n super(message, ErrorCode.INITIALIZATION_FAILED, { cause, details });\n }\n}\n\nexport function isServiceInitializationError(error: unknown): error is ServiceInitializationError {\n return error instanceof ServiceInitializationError;\n}\n\nexport class ServiceUnavailableError extends SdkError {\n override name = 'ServiceUnavailableError';\n\n constructor(message: string = ErrorReason.UNKNOWN, details?: string) {\n super(message, ErrorCode.SERVICE_NOT_AVAILABLE, { details });\n }\n}\n\nexport function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError {\n return error instanceof ServiceUnavailableError;\n}\n\nexport class InsufficientFundsError extends SdkError {\n override name = 'InsufficientFundsError';\n public insufficientTokenWasNative: boolean;\n\n constructor({\n cause,\n details,\n errorCode,\n insufficientTokenWasNative,\n }: {\n errorCode: ErrorCode.VIEM_ERROR | ErrorCode.SOLANA_ERROR;\n details?: string;\n cause?: unknown;\n insufficientTokenWasNative: boolean;\n }) {\n super(\n insufficientTokenWasNative\n ? 'Insufficient native funds to cover the fee.'\n : 'Insufficient token funds to estimate the fee.',\n errorCode,\n { cause, details },\n );\n this.insufficientTokenWasNative = insufficientTokenWasNative;\n }\n}\n\nexport function isInsufficientFundsError(error: unknown): error is InsufficientFundsError {\n return error instanceof InsufficientFundsError;\n}\n\nexport interface EstimateNativeFeeErrorDetails {\n /** Human-readable reason from `Error(string)` or `Panic(uint256)`. */\n reason?: string;\n /** Custom error name from the ABI, e.g. `\"SlippageTooHigh\"`. */\n errorName?: string;\n /** Decoded arguments from the custom error. */\n args?: readonly unknown[];\n /** Raw revert data (hex). */\n data?: `0x${string}`;\n}\n\nexport class EstimateNativeFeeError extends SdkError {\n override name = 'EstimateNativeFeeError';\n public details: EstimateNativeFeeErrorDetails | undefined;\n public tx: string | { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; value?: bigint };\n\n constructor({\n cause,\n details,\n errorCode,\n message = 'Failed to estimate native fee for quote.',\n tx,\n }: {\n cause?: unknown;\n details?: EstimateNativeFeeErrorDetails;\n errorCode: ErrorCode.VIEM_ERROR | ErrorCode.SOLANA_ERROR;\n message?: string;\n tx: string | { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; value?: bigint };\n }) {\n super(message, errorCode, { cause });\n this.details = details;\n this.tx = tx;\n }\n\n /**\n * Helper method to check if the error was caused by insufficient funds to cover the fee.\n * Note that this is a heuristic based on the error details and may not be 100% accurate in all cases.\n * Use with caution and consider inspecting the error details for more context.\n */\n public causedByInsufficientFunds(): boolean {\n return isInsufficientFundsError(this.cause);\n }\n}\n\nexport function isEstimateNativeFeeError(error: unknown): error is EstimateNativeFeeError {\n return error instanceof EstimateNativeFeeError;\n}\n\nexport class InvalidParamsError extends SdkError {\n override name = 'InvalidParamsError';\n\n constructor(message: string = ErrorReason.INVALID_PARAMS, details?: string) {\n super(message, ErrorCode.INVALID_PARAMS, { details });\n }\n}\n\nexport function isInvalidParamsError(error: unknown): error is InvalidParamsError {\n return error instanceof InvalidParamsError;\n}\n\n/**\n * @internal\n *\n * Error to indicate that a functionality has not yet been implemented.\n * Do not export from entrypoint.\n */\nexport class NotImplementedError extends SdkError {\n constructor() {\n super('This functionality is not yet implemented.', ErrorCode.NOT_IMPLEMENTED);\n }\n}\n"],"mappings":"AAAA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,EAAA,gBAAA,KAAA,kBACA,EAAA,EAAA,sBAAA,MAAA,wBACA,EAAA,EAAA,sBAAA,MAAA,wBACA,EAAA,EAAA,eAAA,MAAA,iBACA,EAAA,EAAA,QAAA,MAAA,UACA,EAAA,EAAA,WAAA,MAAA,aACA,EAAA,EAAA,qBAAA,MAAA,uBACA,EAAA,EAAA,oBAAA,MAAA,sBACA,EAAA,EAAA,eAAA,MAAA,iBACA,EAAA,EAAA,aAAA,MAAA,eAEA,EAAA,EAAA,wBAAA,MAAA,0BAEA,EAAA,EAAA,gCAAA,MAAA,kCAEA,EAAA,EAAA,qBAAA,MAAA,uBACA,EAAA,EAAA,QAAA,MAAA,gBACD,CAEW,EAAL,SAAA,EAAA,OAEL,GAAA,oBAAA,sBAEA,EAAA,oBAAA,sBAEA,EAAA,qBAAA,uBAEA,EAAA,2BAAA,6BAEA,EAAA,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EAAb,cAAwC,CAAS,CAC/C,KAAgB,qBAEhB,YAAY,EAAkB,EAAY,eAAgB,EAAkB,CAC1E,MAAM,EAAS,EAAU,eAAgB,CAAE,UAAS,CAAC,GAIzD,SAAgB,EAAqB,EAA6C,CAChF,OAAO,aAAiB,EAS1B,IAAa,EAAb,cAAyC,CAAS,CAChD,aAAc,CACZ,MAAM,6CAA8C,EAAU,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export enum ErrorCode {\n NOT_IMPLEMENTED = 5_000,\n SERVICE_NOT_AVAILABLE = 5_001,\n INITIALIZATION_FAILED = 5_002,\n INVALID_PARAMS = 5_003,\n TIMEOUT = 5_004,\n VIEM_ERROR = 5_005,\n TRANSACTION_REVERTED = 5_006,\n NOTARIZATION_FAILED = 5_007,\n SIGNING_FAILED = 5_008,\n SOLANA_ERROR = 5_009,\n /** Hyperliquid `withdrawable` dropped below the requested amount between authorize and sendAsset. */\n HL_WITHDRAWABLE_DROPPED = 5_010,\n /** Markr's `/swap` returned an `hyperliquid-withdraw` variant whose `protocolVersion` is unknown to this SDK release. */\n HL_UNSUPPORTED_PROTOCOL_VERSION = 5_011,\n /** Hyperliquid `/exchange` returned `{ status: \"err\" }`. */\n HL_EXCHANGE_REJECTED = 5_012,\n UNKNOWN = 5_999,\n}\n\nexport enum ErrorReason {\n /** the provided asset is not supported by the bridge */\n ASSET_NOT_SUPPORTED = 'ASSET_NOT_SUPPORTED',\n /** the provided source or target chain is not supported by the bridge */\n CHAIN_NOT_SUPPORTED = 'CHAIN_NOT_SUPPORTED',\n /** error while fetching or parsing the config */\n CONFIG_NOT_AVAILABLE = 'CONFIG_NOT_AVAILABLE',\n /** required confirmation count of the source or target chain is unknown */\n CONFIRMATION_COUNT_UNKNOWN = 'CONFIRMATION_COUNT_UNKNOWN',\n /** service is being initialized more than once */\n DUPLICATE_SERVICE_INITIALIZATION = 'DUPLICATE_SERVICE_INITIALIZATION',\n /** bridge does not support specified environment */\n ENVIRONMENT_NOT_SUPPORTED = 'ENVIRONMENT_NOT_SUPPORTED',\n /** provided source and target chains are the same */\n IDENTICAL_CHAINS_PROVIDED = 'IDENTICAL_CHAINS_PROVIDED',\n /** the sender or recipient address is incorrect */\n INCORRECT_ADDRESS_PROVIDED = 'INCORRECT_ADDRESS_PROVIDED',\n /** the transfer amount is incorrect (e.g.: lesser than or equal to zero) */\n INCORRECT_AMOUNT_PROVIDED = 'INCORRECT_AMOUNT_PROVIDED',\n /** the transaction is not hex */\n INCORRECT_HASH_PROVIDED = 'INCORRECT_HASH_PROVIDED',\n /** The provided provider is incorrect type (Provider VS BitcoinProvider) */\n INCORRECT_PROVIDER_PROVIDED = 'INCORRECT_PROVIDER_PROVIDED',\n /** The provided signer is incorrect type */\n INCORRECT_SIGNER_PROVIDED = 'INCORRECT_SIGNER_PROVIDED',\n /** the sourceTxHash or targetTxHash is incorrect */\n INCORRECT_TXHASH_PROVIDED = 'INCORRECT_TXHASH_PROVIDED',\n /** generic error with the params */\n INVALID_PARAMS = 'INVALID_PARAMS',\n /** ServiceType requested not available */\n SERVICE_TYPE_NOT_CONFIGURED = 'SERVICE_TYPE_NOT_CONFIGURED',\n /** generic, not specified error */\n UNKNOWN = 'UNKNOWN',\n /** error when the address has token approvals for addresses involved in the multichain incident */\n VULNERABLE_TOKEN_APPROVAL_ADDRESS = 'VULNERABLE_TOKEN_APPROVAL_ADDRESS',\n /** error when warden config was not found or it is over the mismatch threshold */\n WARDEN_CONFIG_MISMATCH = 'WARDEN_CONFIG_MISMATCH',\n /** fetched warden config does not contain network IDs */\n WARDEN_CONFIG_MISSING_NETWORK = 'WARDEN_CONFIG_MISSING_NETWORK',\n /** address is blocked */\n ADDRESS_IS_BLOCKED = 'ADDRESS_IS_BLOCKED',\n /** Quote expired */\n QUOTE_EXPIRED = 'QUOTE_EXPIRED',\n /**\n * The on-chain `WAVAX.deposit{value}()` transaction the SDK signed as the\n * first leg of a native-input recurring schedule was mined as reverted —\n * the user does not hold the wrapped balance the downstream `createOrder`\n * needs, so the schedule was not created.\n */\n NATIVE_WRAP_REVERTED = 'NATIVE_WRAP_REVERTED',\n /**\n * Markr's `/recurring/swap` response shape did not agree with the cached\n * quote's `tokenIn` — e.g. native input returned without a wrap step, an\n * ERC-20 input returned with one, or `createOrder` is missing entirely.\n * Signing the response as-is would broadcast a mismatched flow (charge\n * native the user didn't authorize, or skip a wrap they needed), so the\n * SDK refuses. See `details` on the thrown `SdkError` for which variant\n * fired.\n */\n RECURRING_SWAP_RESPONSE_INCONSISTENT = 'RECURRING_SWAP_RESPONSE_INCONSISTENT',\n}\n\nexport class SdkError extends Error {\n override name = 'SdkError';\n\n constructor(\n message: string,\n public code: ErrorCode,\n public options?: {\n cause?: unknown;\n details?: string;\n },\n ) {\n super(message, { cause: options?.cause });\n }\n\n walk(): Error;\n walk(fn: (err: unknown) => boolean): Error | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walk(fn?: any): any {\n return walkError(this, fn);\n }\n}\n\nfunction walkError(err: unknown): unknown;\nfunction walkError(err: unknown, fn: (err: unknown) => boolean): unknown | null;\nfunction walkError(err: unknown, fn?: ((err: unknown) => boolean) | undefined): unknown | null;\nfunction walkError(err: unknown, fn?: ((err: unknown) => boolean) | undefined): unknown | null {\n if (fn?.(err)) {\n return err;\n }\n\n if (err && typeof err === 'object' && 'cause' in err && err.cause !== undefined) {\n return walkError(err.cause, fn);\n }\n\n return fn ? null : err;\n}\n\nexport function isSdkError(error: unknown): error is SdkError {\n return error instanceof SdkError;\n}\n\nexport class HttpError extends Error {\n override name = 'HttpError';\n\n readonly status: number;\n readonly statusText: string;\n readonly response: Response;\n readonly data?: unknown;\n\n constructor(message: string, response: Response, data?: unknown) {\n super(message);\n this.name = 'HttpError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.response = response;\n this.data = data;\n }\n}\n\nexport function isHttpError(error: unknown): error is HttpError {\n return error instanceof HttpError;\n}\n\nexport class TimeoutError extends Error {\n override name = 'TimeoutError';\n\n constructor(message = 'Request timed out.') {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n\nexport function isTimeoutError(error: unknown): error is TimeoutError {\n return error instanceof TimeoutError;\n}\n\nexport class AbortedError extends Error {\n override name = 'AbortedError';\n\n constructor(message = 'Operation was aborted.') {\n super(message);\n this.name = 'AbortedError';\n }\n}\n\nexport function isAbortedError(error: unknown): error is AbortedError {\n return error instanceof AbortedError;\n}\n\nexport class ResponseValidationError extends Error {\n override name = 'ResponseValidationError';\n\n readonly issues?: unknown;\n readonly rawResponse?: unknown;\n\n constructor(message = 'Response validation failed.', issues?: unknown, rawResponse?: unknown) {\n super(message);\n this.name = 'ResponseValidationError';\n this.issues = issues;\n this.rawResponse = rawResponse;\n }\n}\n\nexport function isResponseValidationError(error: unknown): error is ResponseValidationError {\n return error instanceof ResponseValidationError;\n}\n\nexport class ServiceInitializationError extends SdkError {\n override name = 'ServiceInitializationError';\n\n constructor(message: string = ErrorReason.UNKNOWN, details?: string, cause?: unknown) {\n super(message, ErrorCode.INITIALIZATION_FAILED, { cause, details });\n }\n}\n\nexport function isServiceInitializationError(error: unknown): error is ServiceInitializationError {\n return error instanceof ServiceInitializationError;\n}\n\nexport class ServiceUnavailableError extends SdkError {\n override name = 'ServiceUnavailableError';\n\n constructor(message: string = ErrorReason.UNKNOWN, details?: string) {\n super(message, ErrorCode.SERVICE_NOT_AVAILABLE, { details });\n }\n}\n\nexport function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError {\n return error instanceof ServiceUnavailableError;\n}\n\nexport class InsufficientFundsError extends SdkError {\n override name = 'InsufficientFundsError';\n public insufficientTokenWasNative: boolean;\n\n constructor({\n cause,\n details,\n errorCode,\n insufficientTokenWasNative,\n }: {\n errorCode: ErrorCode.VIEM_ERROR | ErrorCode.SOLANA_ERROR;\n details?: string;\n cause?: unknown;\n insufficientTokenWasNative: boolean;\n }) {\n super(\n insufficientTokenWasNative\n ? 'Insufficient native funds to cover the fee.'\n : 'Insufficient token funds to estimate the fee.',\n errorCode,\n { cause, details },\n );\n this.insufficientTokenWasNative = insufficientTokenWasNative;\n }\n}\n\nexport function isInsufficientFundsError(error: unknown): error is InsufficientFundsError {\n return error instanceof InsufficientFundsError;\n}\n\nexport interface EstimateNativeFeeErrorDetails {\n /** Human-readable reason from `Error(string)` or `Panic(uint256)`. */\n reason?: string;\n /** Custom error name from the ABI, e.g. `\"SlippageTooHigh\"`. */\n errorName?: string;\n /** Decoded arguments from the custom error. */\n args?: readonly unknown[];\n /** Raw revert data (hex). */\n data?: `0x${string}`;\n}\n\nexport class EstimateNativeFeeError extends SdkError {\n override name = 'EstimateNativeFeeError';\n public details: EstimateNativeFeeErrorDetails | undefined;\n public tx: string | { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; value?: bigint };\n\n constructor({\n cause,\n details,\n errorCode,\n message = 'Failed to estimate native fee for quote.',\n tx,\n }: {\n cause?: unknown;\n details?: EstimateNativeFeeErrorDetails;\n errorCode: ErrorCode.VIEM_ERROR | ErrorCode.SOLANA_ERROR;\n message?: string;\n tx: string | { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; value?: bigint };\n }) {\n super(message, errorCode, { cause });\n this.details = details;\n this.tx = tx;\n }\n\n /**\n * Helper method to check if the error was caused by insufficient funds to cover the fee.\n * Note that this is a heuristic based on the error details and may not be 100% accurate in all cases.\n * Use with caution and consider inspecting the error details for more context.\n */\n public causedByInsufficientFunds(): boolean {\n return isInsufficientFundsError(this.cause);\n }\n}\n\nexport function isEstimateNativeFeeError(error: unknown): error is EstimateNativeFeeError {\n return error instanceof EstimateNativeFeeError;\n}\n\nexport class InvalidParamsError extends SdkError {\n override name = 'InvalidParamsError';\n\n constructor(message: string = ErrorReason.INVALID_PARAMS, details?: string) {\n super(message, ErrorCode.INVALID_PARAMS, { details });\n }\n}\n\nexport function isInvalidParamsError(error: unknown): error is InvalidParamsError {\n return error instanceof InvalidParamsError;\n}\n\n/**\n * @internal\n *\n * Error to indicate that a functionality has not yet been implemented.\n * Do not export from entrypoint.\n */\nexport class NotImplementedError extends SdkError {\n constructor() {\n super('This functionality is not yet implemented.', ErrorCode.NOT_IMPLEMENTED);\n }\n}\n"],"mappings":"AAAA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,EAAA,gBAAA,KAAA,kBACA,EAAA,EAAA,sBAAA,MAAA,wBACA,EAAA,EAAA,sBAAA,MAAA,wBACA,EAAA,EAAA,eAAA,MAAA,iBACA,EAAA,EAAA,QAAA,MAAA,UACA,EAAA,EAAA,WAAA,MAAA,aACA,EAAA,EAAA,qBAAA,MAAA,uBACA,EAAA,EAAA,oBAAA,MAAA,sBACA,EAAA,EAAA,eAAA,MAAA,iBACA,EAAA,EAAA,aAAA,MAAA,eAEA,EAAA,EAAA,wBAAA,MAAA,0BAEA,EAAA,EAAA,gCAAA,MAAA,kCAEA,EAAA,EAAA,qBAAA,MAAA,uBACA,EAAA,EAAA,QAAA,MAAA,gBACD,CAEW,EAAL,SAAA,EAAA,OAEL,GAAA,oBAAA,sBAEA,EAAA,oBAAA,sBAEA,EAAA,qBAAA,uBAEA,EAAA,2BAAA,6BAEA,EAAA,iCAAA,mCAEA,EAAA,0BAAA,4BAEA,EAAA,0BAAA,4BAEA,EAAA,2BAAA,6BAEA,EAAA,0BAAA,4BAEA,EAAA,wBAAA,0BAEA,EAAA,4BAAA,8BAEA,EAAA,0BAAA,4BAEA,EAAA,0BAAA,4BAEA,EAAA,eAAA,iBAEA,EAAA,4BAAA,8BAEA,EAAA,QAAA,UAEA,EAAA,kCAAA,oCAEA,EAAA,uBAAA,yBAEA,EAAA,8BAAA,gCAEA,EAAA,mBAAA,qBAEA,EAAA,cAAA,gBAOA,EAAA,qBAAA,uBAUA,EAAA,qCAAA,6CACD,CAED,IAAa,EAAb,cAA8B,KAAM,CAClC,KAAgB,WAEhB,YACE,EACA,EACA,EAIA,CACA,MAAM,EAAS,CAAE,MAAO,GAAS,MAAO,CAAC,CANlC,KAAA,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CAAE,QAAO,UAAS,CAAC,GAIvE,SAAgB,EAA6B,EAAqD,CAChG,OAAO,aAAiB,EAG1B,IAAa,EAAb,cAA6C,CAAS,CACpD,KAAgB,0BAEhB,YAAY,EAAkB,EAAY,QAAS,EAAkB,CACnE,MAAM,EAAS,EAAU,sBAAuB,CAAE,UAAS,CAAC,GAIhE,SAAgB,EAA0B,EAAkD,CAC1F,OAAO,aAAiB,EAG1B,IAAa,EAAb,cAA4C,CAAS,CACnD,KAAgB,yBAChB,2BAEA,YAAY,CACV,QACA,UACA,YACA,8BAMC,CACD,MACE,EACI,8CACA,gDACJ,EACA,CAAE,QAAO,UAAS,CACnB,CACD,KAAK,2BAA6B,IAItC,SAAgB,EAAyB,EAAiD,CACxF,OAAO,aAAiB,EAc1B,IAAa,EAAb,cAA4C,CAAS,CACnD,KAAgB,yBAChB,QACA,GAEA,YAAY,CACV,QACA,UACA,YACA,UAAU,2CACV,MAOC,CACD,MAAM,EAAS,EAAW,CAAE,QAAO,CAAC,CACpC,KAAK,QAAU,EACf,KAAK,GAAK,EAQZ,2BAA4C,CAC1C,OAAO,EAAyB,KAAK,MAAM,GAI/C,SAAgB,EAAyB,EAAiD,CACxF,OAAO,aAAiB,EAG1B,IAAa,EAAb,cAAwC,CAAS,CAC/C,KAAgB,qBAEhB,YAAY,EAAkB,EAAY,eAAgB,EAAkB,CAC1E,MAAM,EAAS,EAAU,eAAgB,CAAE,UAAS,CAAC,GAIzD,SAAgB,EAAqB,EAA6C,CAChF,OAAO,aAAiB,EAS1B,IAAa,EAAb,cAAyC,CAAS,CAChD,aAAc,CACZ,MAAM,6CAA8C,EAAU,gBAAgB"}
|
package/dist/errors.d.cts
CHANGED
|
@@ -60,7 +60,24 @@ declare enum ErrorReason {
|
|
|
60
60
|
/** address is blocked */
|
|
61
61
|
ADDRESS_IS_BLOCKED = "ADDRESS_IS_BLOCKED",
|
|
62
62
|
/** Quote expired */
|
|
63
|
-
QUOTE_EXPIRED = "QUOTE_EXPIRED"
|
|
63
|
+
QUOTE_EXPIRED = "QUOTE_EXPIRED",
|
|
64
|
+
/**
|
|
65
|
+
* The on-chain `WAVAX.deposit{value}()` transaction the SDK signed as the
|
|
66
|
+
* first leg of a native-input recurring schedule was mined as reverted —
|
|
67
|
+
* the user does not hold the wrapped balance the downstream `createOrder`
|
|
68
|
+
* needs, so the schedule was not created.
|
|
69
|
+
*/
|
|
70
|
+
NATIVE_WRAP_REVERTED = "NATIVE_WRAP_REVERTED",
|
|
71
|
+
/**
|
|
72
|
+
* Markr's `/recurring/swap` response shape did not agree with the cached
|
|
73
|
+
* quote's `tokenIn` — e.g. native input returned without a wrap step, an
|
|
74
|
+
* ERC-20 input returned with one, or `createOrder` is missing entirely.
|
|
75
|
+
* Signing the response as-is would broadcast a mismatched flow (charge
|
|
76
|
+
* native the user didn't authorize, or skip a wrap they needed), so the
|
|
77
|
+
* SDK refuses. See `details` on the thrown `SdkError` for which variant
|
|
78
|
+
* fired.
|
|
79
|
+
*/
|
|
80
|
+
RECURRING_SWAP_RESPONSE_INCONSISTENT = "RECURRING_SWAP_RESPONSE_INCONSISTENT"
|
|
64
81
|
}
|
|
65
82
|
declare class SdkError extends Error {
|
|
66
83
|
code: ErrorCode;
|
package/dist/errors.d.ts
CHANGED
|
@@ -60,7 +60,24 @@ declare enum ErrorReason {
|
|
|
60
60
|
/** address is blocked */
|
|
61
61
|
ADDRESS_IS_BLOCKED = "ADDRESS_IS_BLOCKED",
|
|
62
62
|
/** Quote expired */
|
|
63
|
-
QUOTE_EXPIRED = "QUOTE_EXPIRED"
|
|
63
|
+
QUOTE_EXPIRED = "QUOTE_EXPIRED",
|
|
64
|
+
/**
|
|
65
|
+
* The on-chain `WAVAX.deposit{value}()` transaction the SDK signed as the
|
|
66
|
+
* first leg of a native-input recurring schedule was mined as reverted —
|
|
67
|
+
* the user does not hold the wrapped balance the downstream `createOrder`
|
|
68
|
+
* needs, so the schedule was not created.
|
|
69
|
+
*/
|
|
70
|
+
NATIVE_WRAP_REVERTED = "NATIVE_WRAP_REVERTED",
|
|
71
|
+
/**
|
|
72
|
+
* Markr's `/recurring/swap` response shape did not agree with the cached
|
|
73
|
+
* quote's `tokenIn` — e.g. native input returned without a wrap step, an
|
|
74
|
+
* ERC-20 input returned with one, or `createOrder` is missing entirely.
|
|
75
|
+
* Signing the response as-is would broadcast a mismatched flow (charge
|
|
76
|
+
* native the user didn't authorize, or skip a wrap they needed), so the
|
|
77
|
+
* SDK refuses. See `details` on the thrown `SdkError` for which variant
|
|
78
|
+
* fired.
|
|
79
|
+
*/
|
|
80
|
+
RECURRING_SWAP_RESPONSE_INCONSISTENT = "RECURRING_SWAP_RESPONSE_INCONSISTENT"
|
|
64
81
|
}
|
|
65
82
|
declare class SdkError extends Error {
|
|
66
83
|
code: ErrorCode;
|
package/dist/errors.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
let e=function(e){return e[e.NOT_IMPLEMENTED=5e3]=`NOT_IMPLEMENTED`,e[e.SERVICE_NOT_AVAILABLE=5001]=`SERVICE_NOT_AVAILABLE`,e[e.INITIALIZATION_FAILED=5002]=`INITIALIZATION_FAILED`,e[e.INVALID_PARAMS=5003]=`INVALID_PARAMS`,e[e.TIMEOUT=5004]=`TIMEOUT`,e[e.VIEM_ERROR=5005]=`VIEM_ERROR`,e[e.TRANSACTION_REVERTED=5006]=`TRANSACTION_REVERTED`,e[e.NOTARIZATION_FAILED=5007]=`NOTARIZATION_FAILED`,e[e.SIGNING_FAILED=5008]=`SIGNING_FAILED`,e[e.SOLANA_ERROR=5009]=`SOLANA_ERROR`,e[e.HL_WITHDRAWABLE_DROPPED=5010]=`HL_WITHDRAWABLE_DROPPED`,e[e.HL_UNSUPPORTED_PROTOCOL_VERSION=5011]=`HL_UNSUPPORTED_PROTOCOL_VERSION`,e[e.HL_EXCHANGE_REJECTED=5012]=`HL_EXCHANGE_REJECTED`,e[e.UNKNOWN=5999]=`UNKNOWN`,e}({}),t=function(e){return e.ASSET_NOT_SUPPORTED=`ASSET_NOT_SUPPORTED`,e.CHAIN_NOT_SUPPORTED=`CHAIN_NOT_SUPPORTED`,e.CONFIG_NOT_AVAILABLE=`CONFIG_NOT_AVAILABLE`,e.CONFIRMATION_COUNT_UNKNOWN=`CONFIRMATION_COUNT_UNKNOWN`,e.DUPLICATE_SERVICE_INITIALIZATION=`DUPLICATE_SERVICE_INITIALIZATION`,e.ENVIRONMENT_NOT_SUPPORTED=`ENVIRONMENT_NOT_SUPPORTED`,e.IDENTICAL_CHAINS_PROVIDED=`IDENTICAL_CHAINS_PROVIDED`,e.INCORRECT_ADDRESS_PROVIDED=`INCORRECT_ADDRESS_PROVIDED`,e.INCORRECT_AMOUNT_PROVIDED=`INCORRECT_AMOUNT_PROVIDED`,e.INCORRECT_HASH_PROVIDED=`INCORRECT_HASH_PROVIDED`,e.INCORRECT_PROVIDER_PROVIDED=`INCORRECT_PROVIDER_PROVIDED`,e.INCORRECT_SIGNER_PROVIDED=`INCORRECT_SIGNER_PROVIDED`,e.INCORRECT_TXHASH_PROVIDED=`INCORRECT_TXHASH_PROVIDED`,e.INVALID_PARAMS=`INVALID_PARAMS`,e.SERVICE_TYPE_NOT_CONFIGURED=`SERVICE_TYPE_NOT_CONFIGURED`,e.UNKNOWN=`UNKNOWN`,e.VULNERABLE_TOKEN_APPROVAL_ADDRESS=`VULNERABLE_TOKEN_APPROVAL_ADDRESS`,e.WARDEN_CONFIG_MISMATCH=`WARDEN_CONFIG_MISMATCH`,e.WARDEN_CONFIG_MISSING_NETWORK=`WARDEN_CONFIG_MISSING_NETWORK`,e.ADDRESS_IS_BLOCKED=`ADDRESS_IS_BLOCKED`,e.QUOTE_EXPIRED=`QUOTE_EXPIRED`,e}({});var n=class extends Error{name=`SdkError`;constructor(e,t,n){super(e,{cause:n?.cause}),this.code=t,this.options=n}walk(e){return r(this,e)}};function r(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?r(e.cause,t):t?null:e}function i(e){return e instanceof n}var a=class extends Error{name=`HttpError`;status;statusText;response;data;constructor(e,t,n){super(e),this.name=`HttpError`,this.status=t.status,this.statusText=t.statusText,this.response=t,this.data=n}};function o(e){return e instanceof a}var s=class extends Error{name=`TimeoutError`;constructor(e=`Request timed out.`){super(e),this.name=`TimeoutError`}};function c(e){return e instanceof s}var l=class extends Error{name=`AbortedError`;constructor(e=`Operation was aborted.`){super(e),this.name=`AbortedError`}};function u(e){return e instanceof l}var d=class extends Error{name=`ResponseValidationError`;issues;rawResponse;constructor(e=`Response validation failed.`,t,n){super(e),this.name=`ResponseValidationError`,this.issues=t,this.rawResponse=n}};function f(e){return e instanceof d}var p=class extends n{name=`ServiceInitializationError`;constructor(n=t.UNKNOWN,r,i){super(n,e.INITIALIZATION_FAILED,{cause:i,details:r})}};function m(e){return e instanceof p}var h=class extends n{name=`ServiceUnavailableError`;constructor(n=t.UNKNOWN,r){super(n,e.SERVICE_NOT_AVAILABLE,{details:r})}};function g(e){return e instanceof h}var _=class extends n{name=`InsufficientFundsError`;insufficientTokenWasNative;constructor({cause:e,details:t,errorCode:n,insufficientTokenWasNative:r}){super(r?`Insufficient native funds to cover the fee.`:`Insufficient token funds to estimate the fee.`,n,{cause:e,details:t}),this.insufficientTokenWasNative=r}};function v(e){return e instanceof _}var y=class extends n{name=`EstimateNativeFeeError`;details;tx;constructor({cause:e,details:t,errorCode:n,message:r=`Failed to estimate native fee for quote.`,tx:i}){super(r,n,{cause:e}),this.details=t,this.tx=i}causedByInsufficientFunds(){return v(this.cause)}};function b(e){return e instanceof y}var x=class extends n{name=`InvalidParamsError`;constructor(n=t.INVALID_PARAMS,r){super(n,e.INVALID_PARAMS,{details:r})}};function S(e){return e instanceof x}var C=class extends n{constructor(){super(`This functionality is not yet implemented.`,e.NOT_IMPLEMENTED)}};export{l as AbortedError,e as ErrorCode,t as ErrorReason,y as EstimateNativeFeeError,a as HttpError,_ as InsufficientFundsError,x as InvalidParamsError,C as NotImplementedError,d as ResponseValidationError,n as SdkError,p as ServiceInitializationError,h as ServiceUnavailableError,s as TimeoutError,u as isAbortedError,b as isEstimateNativeFeeError,o as isHttpError,v as isInsufficientFundsError,S as isInvalidParamsError,f as isResponseValidationError,i as isSdkError,m as isServiceInitializationError,g as isServiceUnavailableError,c as isTimeoutError};
|
|
1
|
+
let e=function(e){return e[e.NOT_IMPLEMENTED=5e3]=`NOT_IMPLEMENTED`,e[e.SERVICE_NOT_AVAILABLE=5001]=`SERVICE_NOT_AVAILABLE`,e[e.INITIALIZATION_FAILED=5002]=`INITIALIZATION_FAILED`,e[e.INVALID_PARAMS=5003]=`INVALID_PARAMS`,e[e.TIMEOUT=5004]=`TIMEOUT`,e[e.VIEM_ERROR=5005]=`VIEM_ERROR`,e[e.TRANSACTION_REVERTED=5006]=`TRANSACTION_REVERTED`,e[e.NOTARIZATION_FAILED=5007]=`NOTARIZATION_FAILED`,e[e.SIGNING_FAILED=5008]=`SIGNING_FAILED`,e[e.SOLANA_ERROR=5009]=`SOLANA_ERROR`,e[e.HL_WITHDRAWABLE_DROPPED=5010]=`HL_WITHDRAWABLE_DROPPED`,e[e.HL_UNSUPPORTED_PROTOCOL_VERSION=5011]=`HL_UNSUPPORTED_PROTOCOL_VERSION`,e[e.HL_EXCHANGE_REJECTED=5012]=`HL_EXCHANGE_REJECTED`,e[e.UNKNOWN=5999]=`UNKNOWN`,e}({}),t=function(e){return e.ASSET_NOT_SUPPORTED=`ASSET_NOT_SUPPORTED`,e.CHAIN_NOT_SUPPORTED=`CHAIN_NOT_SUPPORTED`,e.CONFIG_NOT_AVAILABLE=`CONFIG_NOT_AVAILABLE`,e.CONFIRMATION_COUNT_UNKNOWN=`CONFIRMATION_COUNT_UNKNOWN`,e.DUPLICATE_SERVICE_INITIALIZATION=`DUPLICATE_SERVICE_INITIALIZATION`,e.ENVIRONMENT_NOT_SUPPORTED=`ENVIRONMENT_NOT_SUPPORTED`,e.IDENTICAL_CHAINS_PROVIDED=`IDENTICAL_CHAINS_PROVIDED`,e.INCORRECT_ADDRESS_PROVIDED=`INCORRECT_ADDRESS_PROVIDED`,e.INCORRECT_AMOUNT_PROVIDED=`INCORRECT_AMOUNT_PROVIDED`,e.INCORRECT_HASH_PROVIDED=`INCORRECT_HASH_PROVIDED`,e.INCORRECT_PROVIDER_PROVIDED=`INCORRECT_PROVIDER_PROVIDED`,e.INCORRECT_SIGNER_PROVIDED=`INCORRECT_SIGNER_PROVIDED`,e.INCORRECT_TXHASH_PROVIDED=`INCORRECT_TXHASH_PROVIDED`,e.INVALID_PARAMS=`INVALID_PARAMS`,e.SERVICE_TYPE_NOT_CONFIGURED=`SERVICE_TYPE_NOT_CONFIGURED`,e.UNKNOWN=`UNKNOWN`,e.VULNERABLE_TOKEN_APPROVAL_ADDRESS=`VULNERABLE_TOKEN_APPROVAL_ADDRESS`,e.WARDEN_CONFIG_MISMATCH=`WARDEN_CONFIG_MISMATCH`,e.WARDEN_CONFIG_MISSING_NETWORK=`WARDEN_CONFIG_MISSING_NETWORK`,e.ADDRESS_IS_BLOCKED=`ADDRESS_IS_BLOCKED`,e.QUOTE_EXPIRED=`QUOTE_EXPIRED`,e.NATIVE_WRAP_REVERTED=`NATIVE_WRAP_REVERTED`,e.RECURRING_SWAP_RESPONSE_INCONSISTENT=`RECURRING_SWAP_RESPONSE_INCONSISTENT`,e}({});var n=class extends Error{name=`SdkError`;constructor(e,t,n){super(e,{cause:n?.cause}),this.code=t,this.options=n}walk(e){return r(this,e)}};function r(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?r(e.cause,t):t?null:e}function i(e){return e instanceof n}var a=class extends Error{name=`HttpError`;status;statusText;response;data;constructor(e,t,n){super(e),this.name=`HttpError`,this.status=t.status,this.statusText=t.statusText,this.response=t,this.data=n}};function o(e){return e instanceof a}var s=class extends Error{name=`TimeoutError`;constructor(e=`Request timed out.`){super(e),this.name=`TimeoutError`}};function c(e){return e instanceof s}var l=class extends Error{name=`AbortedError`;constructor(e=`Operation was aborted.`){super(e),this.name=`AbortedError`}};function u(e){return e instanceof l}var d=class extends Error{name=`ResponseValidationError`;issues;rawResponse;constructor(e=`Response validation failed.`,t,n){super(e),this.name=`ResponseValidationError`,this.issues=t,this.rawResponse=n}};function f(e){return e instanceof d}var p=class extends n{name=`ServiceInitializationError`;constructor(n=t.UNKNOWN,r,i){super(n,e.INITIALIZATION_FAILED,{cause:i,details:r})}};function m(e){return e instanceof p}var h=class extends n{name=`ServiceUnavailableError`;constructor(n=t.UNKNOWN,r){super(n,e.SERVICE_NOT_AVAILABLE,{details:r})}};function g(e){return e instanceof h}var _=class extends n{name=`InsufficientFundsError`;insufficientTokenWasNative;constructor({cause:e,details:t,errorCode:n,insufficientTokenWasNative:r}){super(r?`Insufficient native funds to cover the fee.`:`Insufficient token funds to estimate the fee.`,n,{cause:e,details:t}),this.insufficientTokenWasNative=r}};function v(e){return e instanceof _}var y=class extends n{name=`EstimateNativeFeeError`;details;tx;constructor({cause:e,details:t,errorCode:n,message:r=`Failed to estimate native fee for quote.`,tx:i}){super(r,n,{cause:e}),this.details=t,this.tx=i}causedByInsufficientFunds(){return v(this.cause)}};function b(e){return e instanceof y}var x=class extends n{name=`InvalidParamsError`;constructor(n=t.INVALID_PARAMS,r){super(n,e.INVALID_PARAMS,{details:r})}};function S(e){return e instanceof x}var C=class extends n{constructor(){super(`This functionality is not yet implemented.`,e.NOT_IMPLEMENTED)}};export{l as AbortedError,e as ErrorCode,t as ErrorReason,y as EstimateNativeFeeError,a as HttpError,_ as InsufficientFundsError,x as InvalidParamsError,C as NotImplementedError,d as ResponseValidationError,n as SdkError,p as ServiceInitializationError,h as ServiceUnavailableError,s as TimeoutError,u as isAbortedError,b as isEstimateNativeFeeError,o as isHttpError,v as isInsufficientFundsError,S as isInvalidParamsError,f as isResponseValidationError,i as isSdkError,m as isServiceInitializationError,g as isServiceUnavailableError,c as isTimeoutError};
|
|
2
2
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export enum ErrorCode {\n NOT_IMPLEMENTED = 5_000,\n SERVICE_NOT_AVAILABLE = 5_001,\n INITIALIZATION_FAILED = 5_002,\n INVALID_PARAMS = 5_003,\n TIMEOUT = 5_004,\n VIEM_ERROR = 5_005,\n TRANSACTION_REVERTED = 5_006,\n NOTARIZATION_FAILED = 5_007,\n SIGNING_FAILED = 5_008,\n SOLANA_ERROR = 5_009,\n /** Hyperliquid `withdrawable` dropped below the requested amount between authorize and sendAsset. */\n HL_WITHDRAWABLE_DROPPED = 5_010,\n /** Markr's `/swap` returned an `hyperliquid-withdraw` variant whose `protocolVersion` is unknown to this SDK release. */\n HL_UNSUPPORTED_PROTOCOL_VERSION = 5_011,\n /** Hyperliquid `/exchange` returned `{ status: \"err\" }`. */\n HL_EXCHANGE_REJECTED = 5_012,\n UNKNOWN = 5_999,\n}\n\nexport enum ErrorReason {\n /** the provided asset is not supported by the bridge */\n ASSET_NOT_SUPPORTED = 'ASSET_NOT_SUPPORTED',\n /** the provided source or target chain is not supported by the bridge */\n CHAIN_NOT_SUPPORTED = 'CHAIN_NOT_SUPPORTED',\n /** error while fetching or parsing the config */\n CONFIG_NOT_AVAILABLE = 'CONFIG_NOT_AVAILABLE',\n /** required confirmation count of the source or target chain is unknown */\n CONFIRMATION_COUNT_UNKNOWN = 'CONFIRMATION_COUNT_UNKNOWN',\n /** service is being initialized more than once */\n DUPLICATE_SERVICE_INITIALIZATION = 'DUPLICATE_SERVICE_INITIALIZATION',\n /** bridge does not support specified environment */\n ENVIRONMENT_NOT_SUPPORTED = 'ENVIRONMENT_NOT_SUPPORTED',\n /** provided source and target chains are the same */\n IDENTICAL_CHAINS_PROVIDED = 'IDENTICAL_CHAINS_PROVIDED',\n /** the sender or recipient address is incorrect */\n INCORRECT_ADDRESS_PROVIDED = 'INCORRECT_ADDRESS_PROVIDED',\n /** the transfer amount is incorrect (e.g.: lesser than or equal to zero) */\n INCORRECT_AMOUNT_PROVIDED = 'INCORRECT_AMOUNT_PROVIDED',\n /** the transaction is not hex */\n INCORRECT_HASH_PROVIDED = 'INCORRECT_HASH_PROVIDED',\n /** The provided provider is incorrect type (Provider VS BitcoinProvider) */\n INCORRECT_PROVIDER_PROVIDED = 'INCORRECT_PROVIDER_PROVIDED',\n /** The provided signer is incorrect type */\n INCORRECT_SIGNER_PROVIDED = 'INCORRECT_SIGNER_PROVIDED',\n /** the sourceTxHash or targetTxHash is incorrect */\n INCORRECT_TXHASH_PROVIDED = 'INCORRECT_TXHASH_PROVIDED',\n /** generic error with the params */\n INVALID_PARAMS = 'INVALID_PARAMS',\n /** ServiceType requested not available */\n SERVICE_TYPE_NOT_CONFIGURED = 'SERVICE_TYPE_NOT_CONFIGURED',\n /** generic, not specified error */\n UNKNOWN = 'UNKNOWN',\n /** error when the address has token approvals for addresses involved in the multichain incident */\n VULNERABLE_TOKEN_APPROVAL_ADDRESS = 'VULNERABLE_TOKEN_APPROVAL_ADDRESS',\n /** error when warden config was not found or it is over the mismatch threshold */\n WARDEN_CONFIG_MISMATCH = 'WARDEN_CONFIG_MISMATCH',\n /** fetched warden config does not contain network IDs */\n WARDEN_CONFIG_MISSING_NETWORK = 'WARDEN_CONFIG_MISSING_NETWORK',\n /** address is blocked */\n ADDRESS_IS_BLOCKED = 'ADDRESS_IS_BLOCKED',\n /** Quote expired */\n QUOTE_EXPIRED = 'QUOTE_EXPIRED',\n}\n\nexport class SdkError extends Error {\n override name = 'SdkError';\n\n constructor(\n message: string,\n public code: ErrorCode,\n public options?: {\n cause?: unknown;\n details?: string;\n },\n ) {\n super(message, { cause: options?.cause });\n }\n\n walk(): Error;\n walk(fn: (err: unknown) => boolean): Error | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walk(fn?: any): any {\n return walkError(this, fn);\n }\n}\n\nfunction walkError(err: unknown): unknown;\nfunction walkError(err: unknown, fn: (err: unknown) => boolean): unknown | null;\nfunction walkError(err: unknown, fn?: ((err: unknown) => boolean) | undefined): unknown | null;\nfunction walkError(err: unknown, fn?: ((err: unknown) => boolean) | undefined): unknown | null {\n if (fn?.(err)) {\n return err;\n }\n\n if (err && typeof err === 'object' && 'cause' in err && err.cause !== undefined) {\n return walkError(err.cause, fn);\n }\n\n return fn ? null : err;\n}\n\nexport function isSdkError(error: unknown): error is SdkError {\n return error instanceof SdkError;\n}\n\nexport class HttpError extends Error {\n override name = 'HttpError';\n\n readonly status: number;\n readonly statusText: string;\n readonly response: Response;\n readonly data?: unknown;\n\n constructor(message: string, response: Response, data?: unknown) {\n super(message);\n this.name = 'HttpError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.response = response;\n this.data = data;\n }\n}\n\nexport function isHttpError(error: unknown): error is HttpError {\n return error instanceof HttpError;\n}\n\nexport class TimeoutError extends Error {\n override name = 'TimeoutError';\n\n constructor(message = 'Request timed out.') {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n\nexport function isTimeoutError(error: unknown): error is TimeoutError {\n return error instanceof TimeoutError;\n}\n\nexport class AbortedError extends Error {\n override name = 'AbortedError';\n\n constructor(message = 'Operation was aborted.') {\n super(message);\n this.name = 'AbortedError';\n }\n}\n\nexport function isAbortedError(error: unknown): error is AbortedError {\n return error instanceof AbortedError;\n}\n\nexport class ResponseValidationError extends Error {\n override name = 'ResponseValidationError';\n\n readonly issues?: unknown;\n readonly rawResponse?: unknown;\n\n constructor(message = 'Response validation failed.', issues?: unknown, rawResponse?: unknown) {\n super(message);\n this.name = 'ResponseValidationError';\n this.issues = issues;\n this.rawResponse = rawResponse;\n }\n}\n\nexport function isResponseValidationError(error: unknown): error is ResponseValidationError {\n return error instanceof ResponseValidationError;\n}\n\nexport class ServiceInitializationError extends SdkError {\n override name = 'ServiceInitializationError';\n\n constructor(message: string = ErrorReason.UNKNOWN, details?: string, cause?: unknown) {\n super(message, ErrorCode.INITIALIZATION_FAILED, { cause, details });\n }\n}\n\nexport function isServiceInitializationError(error: unknown): error is ServiceInitializationError {\n return error instanceof ServiceInitializationError;\n}\n\nexport class ServiceUnavailableError extends SdkError {\n override name = 'ServiceUnavailableError';\n\n constructor(message: string = ErrorReason.UNKNOWN, details?: string) {\n super(message, ErrorCode.SERVICE_NOT_AVAILABLE, { details });\n }\n}\n\nexport function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError {\n return error instanceof ServiceUnavailableError;\n}\n\nexport class InsufficientFundsError extends SdkError {\n override name = 'InsufficientFundsError';\n public insufficientTokenWasNative: boolean;\n\n constructor({\n cause,\n details,\n errorCode,\n insufficientTokenWasNative,\n }: {\n errorCode: ErrorCode.VIEM_ERROR | ErrorCode.SOLANA_ERROR;\n details?: string;\n cause?: unknown;\n insufficientTokenWasNative: boolean;\n }) {\n super(\n insufficientTokenWasNative\n ? 'Insufficient native funds to cover the fee.'\n : 'Insufficient token funds to estimate the fee.',\n errorCode,\n { cause, details },\n );\n this.insufficientTokenWasNative = insufficientTokenWasNative;\n }\n}\n\nexport function isInsufficientFundsError(error: unknown): error is InsufficientFundsError {\n return error instanceof InsufficientFundsError;\n}\n\nexport interface EstimateNativeFeeErrorDetails {\n /** Human-readable reason from `Error(string)` or `Panic(uint256)`. */\n reason?: string;\n /** Custom error name from the ABI, e.g. `\"SlippageTooHigh\"`. */\n errorName?: string;\n /** Decoded arguments from the custom error. */\n args?: readonly unknown[];\n /** Raw revert data (hex). */\n data?: `0x${string}`;\n}\n\nexport class EstimateNativeFeeError extends SdkError {\n override name = 'EstimateNativeFeeError';\n public details: EstimateNativeFeeErrorDetails | undefined;\n public tx: string | { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; value?: bigint };\n\n constructor({\n cause,\n details,\n errorCode,\n message = 'Failed to estimate native fee for quote.',\n tx,\n }: {\n cause?: unknown;\n details?: EstimateNativeFeeErrorDetails;\n errorCode: ErrorCode.VIEM_ERROR | ErrorCode.SOLANA_ERROR;\n message?: string;\n tx: string | { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; value?: bigint };\n }) {\n super(message, errorCode, { cause });\n this.details = details;\n this.tx = tx;\n }\n\n /**\n * Helper method to check if the error was caused by insufficient funds to cover the fee.\n * Note that this is a heuristic based on the error details and may not be 100% accurate in all cases.\n * Use with caution and consider inspecting the error details for more context.\n */\n public causedByInsufficientFunds(): boolean {\n return isInsufficientFundsError(this.cause);\n }\n}\n\nexport function isEstimateNativeFeeError(error: unknown): error is EstimateNativeFeeError {\n return error instanceof EstimateNativeFeeError;\n}\n\nexport class InvalidParamsError extends SdkError {\n override name = 'InvalidParamsError';\n\n constructor(message: string = ErrorReason.INVALID_PARAMS, details?: string) {\n super(message, ErrorCode.INVALID_PARAMS, { details });\n }\n}\n\nexport function isInvalidParamsError(error: unknown): error is InvalidParamsError {\n return error instanceof InvalidParamsError;\n}\n\n/**\n * @internal\n *\n * Error to indicate that a functionality has not yet been implemented.\n * Do not export from entrypoint.\n */\nexport class NotImplementedError extends SdkError {\n constructor() {\n super('This functionality is not yet implemented.', ErrorCode.NOT_IMPLEMENTED);\n }\n}\n"],"mappings":"AAAA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,EAAA,gBAAA,KAAA,kBACA,EAAA,EAAA,sBAAA,MAAA,wBACA,EAAA,EAAA,sBAAA,MAAA,wBACA,EAAA,EAAA,eAAA,MAAA,iBACA,EAAA,EAAA,QAAA,MAAA,UACA,EAAA,EAAA,WAAA,MAAA,aACA,EAAA,EAAA,qBAAA,MAAA,uBACA,EAAA,EAAA,oBAAA,MAAA,sBACA,EAAA,EAAA,eAAA,MAAA,iBACA,EAAA,EAAA,aAAA,MAAA,eAEA,EAAA,EAAA,wBAAA,MAAA,0BAEA,EAAA,EAAA,gCAAA,MAAA,kCAEA,EAAA,EAAA,qBAAA,MAAA,uBACA,EAAA,EAAA,QAAA,MAAA,gBACD,CAEW,EAAL,SAAA,EAAA,OAEL,GAAA,oBAAA,sBAEA,EAAA,oBAAA,sBAEA,EAAA,qBAAA,uBAEA,EAAA,2B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AiB,EAG1B,IAAa,EAAb,cAAwC,CAAS,CAC/C,KAAgB,qBAEhB,YAAY,EAAkB,EAAY,eAAgB,EAAkB,CAC1E,MAAM,EAAS,EAAU,eAAgB,CAAE,UAAS,CAAC,GAIzD,SAAgB,EAAqB,EAA6C,CAChF,OAAO,aAAiB,EAS1B,IAAa,EAAb,cAAyC,CAAS,CAChD,aAAc,CACZ,MAAM,6CAA8C,EAAU,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export enum ErrorCode {\n NOT_IMPLEMENTED = 5_000,\n SERVICE_NOT_AVAILABLE = 5_001,\n INITIALIZATION_FAILED = 5_002,\n INVALID_PARAMS = 5_003,\n TIMEOUT = 5_004,\n VIEM_ERROR = 5_005,\n TRANSACTION_REVERTED = 5_006,\n NOTARIZATION_FAILED = 5_007,\n SIGNING_FAILED = 5_008,\n SOLANA_ERROR = 5_009,\n /** Hyperliquid `withdrawable` dropped below the requested amount between authorize and sendAsset. */\n HL_WITHDRAWABLE_DROPPED = 5_010,\n /** Markr's `/swap` returned an `hyperliquid-withdraw` variant whose `protocolVersion` is unknown to this SDK release. */\n HL_UNSUPPORTED_PROTOCOL_VERSION = 5_011,\n /** Hyperliquid `/exchange` returned `{ status: \"err\" }`. */\n HL_EXCHANGE_REJECTED = 5_012,\n UNKNOWN = 5_999,\n}\n\nexport enum ErrorReason {\n /** the provided asset is not supported by the bridge */\n ASSET_NOT_SUPPORTED = 'ASSET_NOT_SUPPORTED',\n /** the provided source or target chain is not supported by the bridge */\n CHAIN_NOT_SUPPORTED = 'CHAIN_NOT_SUPPORTED',\n /** error while fetching or parsing the config */\n CONFIG_NOT_AVAILABLE = 'CONFIG_NOT_AVAILABLE',\n /** required confirmation count of the source or target chain is unknown */\n CONFIRMATION_COUNT_UNKNOWN = 'CONFIRMATION_COUNT_UNKNOWN',\n /** service is being initialized more than once */\n DUPLICATE_SERVICE_INITIALIZATION = 'DUPLICATE_SERVICE_INITIALIZATION',\n /** bridge does not support specified environment */\n ENVIRONMENT_NOT_SUPPORTED = 'ENVIRONMENT_NOT_SUPPORTED',\n /** provided source and target chains are the same */\n IDENTICAL_CHAINS_PROVIDED = 'IDENTICAL_CHAINS_PROVIDED',\n /** the sender or recipient address is incorrect */\n INCORRECT_ADDRESS_PROVIDED = 'INCORRECT_ADDRESS_PROVIDED',\n /** the transfer amount is incorrect (e.g.: lesser than or equal to zero) */\n INCORRECT_AMOUNT_PROVIDED = 'INCORRECT_AMOUNT_PROVIDED',\n /** the transaction is not hex */\n INCORRECT_HASH_PROVIDED = 'INCORRECT_HASH_PROVIDED',\n /** The provided provider is incorrect type (Provider VS BitcoinProvider) */\n INCORRECT_PROVIDER_PROVIDED = 'INCORRECT_PROVIDER_PROVIDED',\n /** The provided signer is incorrect type */\n INCORRECT_SIGNER_PROVIDED = 'INCORRECT_SIGNER_PROVIDED',\n /** the sourceTxHash or targetTxHash is incorrect */\n INCORRECT_TXHASH_PROVIDED = 'INCORRECT_TXHASH_PROVIDED',\n /** generic error with the params */\n INVALID_PARAMS = 'INVALID_PARAMS',\n /** ServiceType requested not available */\n SERVICE_TYPE_NOT_CONFIGURED = 'SERVICE_TYPE_NOT_CONFIGURED',\n /** generic, not specified error */\n UNKNOWN = 'UNKNOWN',\n /** error when the address has token approvals for addresses involved in the multichain incident */\n VULNERABLE_TOKEN_APPROVAL_ADDRESS = 'VULNERABLE_TOKEN_APPROVAL_ADDRESS',\n /** error when warden config was not found or it is over the mismatch threshold */\n WARDEN_CONFIG_MISMATCH = 'WARDEN_CONFIG_MISMATCH',\n /** fetched warden config does not contain network IDs */\n WARDEN_CONFIG_MISSING_NETWORK = 'WARDEN_CONFIG_MISSING_NETWORK',\n /** address is blocked */\n ADDRESS_IS_BLOCKED = 'ADDRESS_IS_BLOCKED',\n /** Quote expired */\n QUOTE_EXPIRED = 'QUOTE_EXPIRED',\n /**\n * The on-chain `WAVAX.deposit{value}()` transaction the SDK signed as the\n * first leg of a native-input recurring schedule was mined as reverted —\n * the user does not hold the wrapped balance the downstream `createOrder`\n * needs, so the schedule was not created.\n */\n NATIVE_WRAP_REVERTED = 'NATIVE_WRAP_REVERTED',\n /**\n * Markr's `/recurring/swap` response shape did not agree with the cached\n * quote's `tokenIn` — e.g. native input returned without a wrap step, an\n * ERC-20 input returned with one, or `createOrder` is missing entirely.\n * Signing the response as-is would broadcast a mismatched flow (charge\n * native the user didn't authorize, or skip a wrap they needed), so the\n * SDK refuses. See `details` on the thrown `SdkError` for which variant\n * fired.\n */\n RECURRING_SWAP_RESPONSE_INCONSISTENT = 'RECURRING_SWAP_RESPONSE_INCONSISTENT',\n}\n\nexport class SdkError extends Error {\n override name = 'SdkError';\n\n constructor(\n message: string,\n public code: ErrorCode,\n public options?: {\n cause?: unknown;\n details?: string;\n },\n ) {\n super(message, { cause: options?.cause });\n }\n\n walk(): Error;\n walk(fn: (err: unknown) => boolean): Error | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walk(fn?: any): any {\n return walkError(this, fn);\n }\n}\n\nfunction walkError(err: unknown): unknown;\nfunction walkError(err: unknown, fn: (err: unknown) => boolean): unknown | null;\nfunction walkError(err: unknown, fn?: ((err: unknown) => boolean) | undefined): unknown | null;\nfunction walkError(err: unknown, fn?: ((err: unknown) => boolean) | undefined): unknown | null {\n if (fn?.(err)) {\n return err;\n }\n\n if (err && typeof err === 'object' && 'cause' in err && err.cause !== undefined) {\n return walkError(err.cause, fn);\n }\n\n return fn ? null : err;\n}\n\nexport function isSdkError(error: unknown): error is SdkError {\n return error instanceof SdkError;\n}\n\nexport class HttpError extends Error {\n override name = 'HttpError';\n\n readonly status: number;\n readonly statusText: string;\n readonly response: Response;\n readonly data?: unknown;\n\n constructor(message: string, response: Response, data?: unknown) {\n super(message);\n this.name = 'HttpError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.response = response;\n this.data = data;\n }\n}\n\nexport function isHttpError(error: unknown): error is HttpError {\n return error instanceof HttpError;\n}\n\nexport class TimeoutError extends Error {\n override name = 'TimeoutError';\n\n constructor(message = 'Request timed out.') {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n\nexport function isTimeoutError(error: unknown): error is TimeoutError {\n return error instanceof TimeoutError;\n}\n\nexport class AbortedError extends Error {\n override name = 'AbortedError';\n\n constructor(message = 'Operation was aborted.') {\n super(message);\n this.name = 'AbortedError';\n }\n}\n\nexport function isAbortedError(error: unknown): error is AbortedError {\n return error instanceof AbortedError;\n}\n\nexport class ResponseValidationError extends Error {\n override name = 'ResponseValidationError';\n\n readonly issues?: unknown;\n readonly rawResponse?: unknown;\n\n constructor(message = 'Response validation failed.', issues?: unknown, rawResponse?: unknown) {\n super(message);\n this.name = 'ResponseValidationError';\n this.issues = issues;\n this.rawResponse = rawResponse;\n }\n}\n\nexport function isResponseValidationError(error: unknown): error is ResponseValidationError {\n return error instanceof ResponseValidationError;\n}\n\nexport class ServiceInitializationError extends SdkError {\n override name = 'ServiceInitializationError';\n\n constructor(message: string = ErrorReason.UNKNOWN, details?: string, cause?: unknown) {\n super(message, ErrorCode.INITIALIZATION_FAILED, { cause, details });\n }\n}\n\nexport function isServiceInitializationError(error: unknown): error is ServiceInitializationError {\n return error instanceof ServiceInitializationError;\n}\n\nexport class ServiceUnavailableError extends SdkError {\n override name = 'ServiceUnavailableError';\n\n constructor(message: string = ErrorReason.UNKNOWN, details?: string) {\n super(message, ErrorCode.SERVICE_NOT_AVAILABLE, { details });\n }\n}\n\nexport function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError {\n return error instanceof ServiceUnavailableError;\n}\n\nexport class InsufficientFundsError extends SdkError {\n override name = 'InsufficientFundsError';\n public insufficientTokenWasNative: boolean;\n\n constructor({\n cause,\n details,\n errorCode,\n insufficientTokenWasNative,\n }: {\n errorCode: ErrorCode.VIEM_ERROR | ErrorCode.SOLANA_ERROR;\n details?: string;\n cause?: unknown;\n insufficientTokenWasNative: boolean;\n }) {\n super(\n insufficientTokenWasNative\n ? 'Insufficient native funds to cover the fee.'\n : 'Insufficient token funds to estimate the fee.',\n errorCode,\n { cause, details },\n );\n this.insufficientTokenWasNative = insufficientTokenWasNative;\n }\n}\n\nexport function isInsufficientFundsError(error: unknown): error is InsufficientFundsError {\n return error instanceof InsufficientFundsError;\n}\n\nexport interface EstimateNativeFeeErrorDetails {\n /** Human-readable reason from `Error(string)` or `Panic(uint256)`. */\n reason?: string;\n /** Custom error name from the ABI, e.g. `\"SlippageTooHigh\"`. */\n errorName?: string;\n /** Decoded arguments from the custom error. */\n args?: readonly unknown[];\n /** Raw revert data (hex). */\n data?: `0x${string}`;\n}\n\nexport class EstimateNativeFeeError extends SdkError {\n override name = 'EstimateNativeFeeError';\n public details: EstimateNativeFeeErrorDetails | undefined;\n public tx: string | { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; value?: bigint };\n\n constructor({\n cause,\n details,\n errorCode,\n message = 'Failed to estimate native fee for quote.',\n tx,\n }: {\n cause?: unknown;\n details?: EstimateNativeFeeErrorDetails;\n errorCode: ErrorCode.VIEM_ERROR | ErrorCode.SOLANA_ERROR;\n message?: string;\n tx: string | { account: `0x${string}`; to: `0x${string}`; data: `0x${string}`; value?: bigint };\n }) {\n super(message, errorCode, { cause });\n this.details = details;\n this.tx = tx;\n }\n\n /**\n * Helper method to check if the error was caused by insufficient funds to cover the fee.\n * Note that this is a heuristic based on the error details and may not be 100% accurate in all cases.\n * Use with caution and consider inspecting the error details for more context.\n */\n public causedByInsufficientFunds(): boolean {\n return isInsufficientFundsError(this.cause);\n }\n}\n\nexport function isEstimateNativeFeeError(error: unknown): error is EstimateNativeFeeError {\n return error instanceof EstimateNativeFeeError;\n}\n\nexport class InvalidParamsError extends SdkError {\n override name = 'InvalidParamsError';\n\n constructor(message: string = ErrorReason.INVALID_PARAMS, details?: string) {\n super(message, ErrorCode.INVALID_PARAMS, { details });\n }\n}\n\nexport function isInvalidParamsError(error: unknown): error is InvalidParamsError {\n return error instanceof InvalidParamsError;\n}\n\n/**\n * @internal\n *\n * Error to indicate that a functionality has not yet been implemented.\n * Do not export from entrypoint.\n */\nexport class NotImplementedError extends SdkError {\n constructor() {\n super('This functionality is not yet implemented.', ErrorCode.NOT_IMPLEMENTED);\n }\n}\n"],"mappings":"AAAA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,EAAA,gBAAA,KAAA,kBACA,EAAA,EAAA,sBAAA,MAAA,wBACA,EAAA,EAAA,sBAAA,MAAA,wBACA,EAAA,EAAA,eAAA,MAAA,iBACA,EAAA,EAAA,QAAA,MAAA,UACA,EAAA,EAAA,WAAA,MAAA,aACA,EAAA,EAAA,qBAAA,MAAA,uBACA,EAAA,EAAA,oBAAA,MAAA,sBACA,EAAA,EAAA,eAAA,MAAA,iBACA,EAAA,EAAA,aAAA,MAAA,eAEA,EAAA,EAAA,wBAAA,MAAA,0BAEA,EAAA,EAAA,gCAAA,MAAA,kCAEA,EAAA,EAAA,qBAAA,MAAA,uBACA,EAAA,EAAA,QAAA,MAAA,gBACD,CAEW,EAAL,SAAA,EAAA,OAEL,GAAA,oBAAA,sBAEA,EAAA,oBAAA,sBAEA,EAAA,qBAAA,uBAEA,EAAA,2BAAA,6BAEA,EAAA,iCAAA,mCAEA,EAAA,0BAAA,4BAEA,EAAA,0BAAA,4BAEA,EAAA,2BAAA,6BAEA,EAAA,0BAAA,4BAEA,EAAA,wBAAA,0BAEA,EAAA,4BAAA,8BAEA,EAAA,0BAAA,4BAEA,EAAA,0BAAA,4BAEA,EAAA,eAAA,iBAEA,EAAA,4BAAA,8BAEA,EAAA,QAAA,UAEA,EAAA,kCAAA,oCAEA,EAAA,uBAAA,yBAEA,EAAA,8BAAA,gCAEA,EAAA,mBAAA,qBAEA,EAAA,cAAA,gBAOA,EAAA,qBAAA,uBAUA,EAAA,qCAAA,6CACD,CAED,IAAa,EAAb,cAA8B,KAAM,CAClC,KAAgB,WAEhB,YACE,EACA,EACA,EAIA,CACA,MAAM,EAAS,CAAE,MAAO,GAAS,MAAO,CA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,EAAU,sBAAuB,CAAE,QAAO,UAAS,CAAC,GAIvE,SAAgB,EAA6B,EAAqD,CAChG,OAAO,aAAiB,EAG1B,IAAa,EAAb,cAA6C,CAAS,CACpD,KAAgB,0BAEhB,YAAY,EAAkB,EAAY,QAAS,EAAkB,CACnE,MAAM,EAAS,EAAU,sBAAuB,CAAE,UAAS,CAAC,GAIhE,SAAgB,EAA0B,EAAkD,CAC1F,OAAO,aAAiB,EAG1B,IAAa,EAAb,cAA4C,CAAS,CACnD,KAAgB,yBAChB,2BAEA,YAAY,CACV,QACA,UACA,YACA,8BAMC,CACD,MACE,EACI,8CACA,gDACJ,EACA,CAAE,QAAO,UAAS,CACnB,CACD,KAAK,2BAA6B,IAItC,SAAgB,EAAyB,EAAiD,CACxF,OAAO,aAAiB,EAc1B,IAAa,EAAb,cAA4C,CAAS,CACnD,KAAgB,yBAChB,QACA,GAEA,YAAY,CACV,QACA,UACA,YACA,UAAU,2CACV,MAOC,CACD,MAAM,EAAS,EAAW,CAAE,QAAO,CAAC,CACpC,KAAK,QAAU,EACf,KAAK,GAAK,EAQZ,2BAA4C,CAC1C,OAAO,EAAyB,KAAK,MAAM,GAI/C,SAAgB,EAAyB,EAAiD,CACxF,OAAO,aAAiB,EAG1B,IAAa,EAAb,cAAwC,CAAS,CAC/C,KAAgB,qBAEhB,YAAY,EAAkB,EAAY,eAAgB,EAAkB,CAC1E,MAAM,EAAS,EAAU,eAAgB,CAAE,UAAS,CAAC,GAIzD,SAAgB,EAAqB,EAA6C,CAChF,OAAO,aAAiB,EAS1B,IAAa,EAAb,cAAyC,CAAS,CAChD,aAAc,CACZ,MAAM,6CAA8C,EAAU,gBAAgB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/caip.cjs`),t=require(`../service-schemas.cjs`);let n=require(`zod`);const r=n.z.string().refine(t=>e.isCaip2ChainId(t),{message:`Invalid CAIP-2 chain ID`}).transform(e=>e),i=n.z.object({chainId:n.z.union([n.z.number(),n.z.string()]),chainType:n.z.string(),enabled_services:n.z.array(n.z.enum([`cross-chain-swap`,`cross-chain-quote`,`quote`,`swap`,`token-list`])),logo_url:n.z.url(),name:n.z.string(),lanes:n.z.array(n.z.union([n.z.coerce.number().int().nonnegative(),r]))}),a=i.extend({chainId:n.z.coerce.number().int().nonnegative(),chainType:n.z.literal(`evm`),router:t.EvmAddressSchema.optional(),wrapped_token:t.EvmAddressSchema.optional(),recurring:n.z.object({minFrequencySeconds:n.z.number().int().nonnegative()
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/caip.cjs`),t=require(`../service-schemas.cjs`);let n=require(`zod`);const r=n.z.string().refine(t=>e.isCaip2ChainId(t),{message:`Invalid CAIP-2 chain ID`}).transform(e=>e),i=n.z.object({chainId:n.z.union([n.z.number(),n.z.string()]),chainType:n.z.string(),enabled_services:n.z.array(n.z.enum([`cross-chain-swap`,`cross-chain-quote`,`quote`,`swap`,`token-list`])),logo_url:n.z.url(),name:n.z.string(),lanes:n.z.array(n.z.union([n.z.coerce.number().int().nonnegative(),r]))}),a=i.extend({chainId:n.z.coerce.number().int().nonnegative(),chainType:n.z.literal(`evm`),router:t.EvmAddressSchema.optional(),wrapped_token:t.EvmAddressSchema.optional(),recurring:n.z.object({minFrequencySeconds:n.z.number().int().nonnegative()}).optional()}),o=i.extend({chainId:n.z.string().refine(t=>e.isCaip2ChainId(t)&&t.startsWith(`solana:`),{error:`Is not a valid Solana CAIP-2 ID`}).transform(e=>e),chainType:n.z.literal(`svm`)}),s=n.z.array(n.z.union([a,o,i.refine(e=>e.chainType!==`evm`&&e.chainType!==`svm`,`Known chain types must match their expected schema`)])),c=n.z.array(n.z.object({address:t.EvmAddressSchema,decimals:n.z.number().int().nonnegative().max(18),logo_url:n.z.url(),name:n.z.string(),symbol:n.z.string()})),l=n.z.union([t.EvmAddressSchema,t.SolAddressSchema,t.HyperliquidAddressSchema]),u=n.z.union([n.z.object({aggregator:n.z.object({id:n.z.string(),logo_url:n.z.url(),name:n.z.string()}),amountIn:n.z.coerce.bigint().nonnegative(),amountOut:n.z.coerce.bigint().nonnegative(),chainId:n.z.union([n.z.number().int().nonnegative(),r]),expiredAt:n.z.number().int().nonnegative(),fees:n.z.array(n.z.object({type:n.z.enum([`protocol`,`gas`,`bridge`,`slippage`,`swap`,`other`,`relay`]),name:n.z.string(),amount:n.z.coerce.bigint().nonnegative(),token:n.z.object({chainId:n.z.union([n.z.number().int().nonnegative(),r]),address:l}),extra:n.z.union([n.z.boolean(),n.z.record(n.z.string(),n.z.unknown())]).optional()})).optional(),gasEstimate:n.z.coerce.bigint().nonnegative().optional(),recommendedSlippage:n.z.number().int().nonnegative(),tokenIn:l,tokenInDecimals:n.z.number().int().nonnegative().max(18),tokenOut:l,tokenOutDecimals:n.z.number().int().nonnegative().max(18),uuid:n.z.uuid()}),n.z.object({done:n.z.literal(!0)})]),d=n.z.object({data:t.HexSchema,to:t.EvmAddressSchema,value:n.z.coerce.bigint().nonnegative(),from:t.EvmAddressSchema.optional()}),f=n.z.object({chainType:n.z.literal(`svm`),swapTransaction:n.z.base64()}),p=n.z.object({hyperliquidChain:n.z.string().min(1),destination:t.EvmAddressSchema,sourceDex:n.z.string(),destinationDex:n.z.string(),token:n.z.string().min(1),amount:n.z.string().regex(/^\d+(\.\d+)?$/,`amount must be a positive decimal string`),fromSubAccount:n.z.string()}),m=n.z.object({signatureKind:n.z.literal(`eip712`),domain:n.z.object({name:n.z.string().min(1),version:n.z.string().min(1),chainId:n.z.number().int().nonnegative(),verifyingContract:t.EvmAddressSchema}),types:n.z.record(n.z.string(),n.z.array(n.z.object({name:n.z.string(),type:n.z.string()}))),primaryType:n.z.string().min(1),value:n.z.object({wallet:t.EvmAddressSchema,chainId:n.z.string().min(1),id:t.HashSchema,nonce:n.z.number().int().nonnegative()}).loose()}),h=n.z.object({endpoint:n.z.string().min(1),method:n.z.string().min(1),body:n.z.object({type:n.z.string().min(1),id:t.HashSchema,nonce:n.z.number().int().nonnegative(),wallet:t.EvmAddressSchema,walletChainId:n.z.number().int().nonnegative(),signatureChainId:n.z.number().int().nonnegative()}).loose()}),g=n.z.object({type:n.z.literal(`hyperliquid-withdraw`),protocolVersion:n.z.number().int().positive(),nonce:n.z.string().regex(/^\d+$/,`nonce must be a decimal string`),id:t.HashSchema,requestId:t.HashSchema,parameters:p,sign:m.optional(),authorize:h.optional()}),_=n.z.union([d,f,g]),v=n.z.unknown().refine(e=>!(typeof e==`object`&&e&&`error`in e&&typeof e.error==`string`),{message:`Markr /authorize returned an error envelope despite 2xx status.`}),y=n.z.object({fee:n.z.int().nonnegative(),name:n.z.string()}),b=/[zZ]|[+-]\d{2}:?\d{2}$/,x=n.z.iso.datetime({local:!0}).refine(e=>{let t=b.test(e)?e:`${e}Z`;return n.z.iso.datetime().safeParse(t).success},{error:`Invalid ISO-8601 datetime (must be valid with timezone, or local assumed UTC)`}).transform(e=>b.test(e)?e:`${e}Z`),S=n.z.object({messageId:n.z.string().nullable(),status:n.z.enum([`pending`,`committed`,`pending_execution`,`completed`,`failed`,`refunded`,`unknown`]),description:n.z.string(),sourceChain:n.z.object({name:n.z.string(),transactionHash:n.z.union([t.HashSchema,t.SolSignatureSchema]),timestamp:x,finalized:x.or(n.z.boolean()).nullable()}),destinationChain:n.z.object({name:n.z.string().nullable(),transactionHash:n.z.union([t.HashSchema,t.SolSignatureSchema]).nullable(),bridgeHash:n.z.union([t.HashSchema,t.SolSignatureSchema]).nullable().optional(),timestamp:x.nullable(),finalized:x.nullable()}),progress:n.z.object({committed:n.z.boolean(),commitTimestamp:x.nullable().optional(),executed:n.z.boolean()}),fees:n.z.object({token:n.z.union([t.EvmAddressSchema,t.SolAddressSchema]).nullable(),amount:n.z.coerce.bigint().nonnegative().nullable()}).nullable(),transferredTokens:n.z.array(n.z.object({token:n.z.union([t.EvmAddressSchema,t.SolAddressSchema]),amount:n.z.coerce.bigint().nonnegative()})),debug:n.z.looseObject({messageId:n.z.string(),status:n.z.string(),destinationChain:n.z.string(),destinationTxHash:n.z.string(),relayTxHash:n.z.string(),retryCount:n.z.number().int().nonnegative(),lastRetryAt:n.z.iso.datetime(),sourceChain:n.z.string(),sourceTxHash:n.z.string(),createdAt:n.z.iso.datetime()}).partial().nullable().optional()}),C=n.z.object({address:t.EvmAddressSchema});exports.CrossChainStatusResponseSchema=S,exports.MarkrAuthorizeResponseSchema=v,exports.PartnerInfoResponseSchema=y,exports.QuoteResponseSchema=u,exports.SpenderAddressResponseSchema=C,exports.SupportedChainsResponseSchema=s,exports.SwapResponseSchema=_,exports.TokenListResponseSchema=c,exports.WrappedSwapTransactionResponseSchema=d;
|
|
2
2
|
//# sourceMappingURL=_schema.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_schema.cjs","names":["z","isCaip2ChainId","EvmAddressSchema","SolAddressSchema","HyperliquidAddressSchema","HexSchema","HashSchema","SolSignatureSchema"],"sources":["../../../src/transfer-service/markr/_schema.ts"],"sourcesContent":["import type { Signature, Address as SolAddress } from '@solana/kit';\nimport type { Address as EvmAddress, Hash } from 'viem';\nimport { z } from 'zod';\nimport type { Caip2ChainId } from '../../types/caip';\nimport type { Hex } from '../../types/signer';\nimport { isCaip2ChainId } from '../../utils/caip';\nimport {\n EvmAddressSchema,\n HashSchema,\n HexSchema,\n HyperliquidAddressSchema,\n SolAddressSchema,\n SolSignatureSchema,\n} from '../service-schemas';\n\ninterface SupportedChainsResponseItemBase {\n chainId: number | string;\n chainType: string;\n /** Available services on the chain. Each service has specific functionality */\n enabled_services: Array<'cross-chain-swap' | 'cross-chain-quote' | 'quote' | 'swap' | 'token-list'>;\n /** Chain logo URL */\n logo_url: string;\n /** Chain display name */\n name: string;\n /**\n * List of chain IDs that this chain can swap to via cross-chain aggregators.\n *\n * Empty array means no cross-chain routes available.\n */\n lanes: ReadonlyArray<number | Caip2ChainId>;\n}\n\nexport interface SupportedChainsResponseItemEvm extends SupportedChainsResponseItemBase {\n /** Chain identifier */\n chainId: number;\n /** Chain virtual machine type */\n chainType: 'evm';\n /** Router contract address */\n router?: EvmAddress;\n /** Native token wrapped contract address */\n wrapped_token?: EvmAddress;\n /**\n * Recurring-swap (DCA) capability metadata for this chain. Absent when the\n * orchestrator does not enable recurring swaps for the chain.\n *\n * @see https://orchestrator-docs.markr.io/#/Recurring%20Swaps\n */\n recurring?: {\n /** Lower bound for `intervalSeconds` accepted by `/recurring/quote`. */\n minFrequencySeconds: number;\n supportedTokens: ReadonlyArray<{\n address: EvmAddress;\n /** Smallest-unit decimal string — per-order minimum input. */\n minimumAmount: string;\n }>;\n };\n}\n\nexport interface SupportedChainsResponseItemSvm extends SupportedChainsResponseItemBase {\n /** Chain identifier */\n chainId: Caip2ChainId;\n /** Chain virtual machine type */\n chainType: 'svm';\n}\n\nexport type SupportedChainsResponse = Array<\n SupportedChainsResponseItemEvm | SupportedChainsResponseItemSvm | SupportedChainsResponseItemBase\n>;\n\nexport const Caip2ChainIdSchema: z.ZodType<Caip2ChainId> = z\n .string()\n .refine((value) => isCaip2ChainId(value), {\n message: 'Invalid CAIP-2 chain ID',\n })\n .transform((value) => value as Caip2ChainId);\n\nconst SupportedChainsResponseItemBaseSchema = z.object({\n chainId: z.union([z.number(), z.string()]),\n chainType: z.string(),\n enabled_services: z.array(z.enum(['cross-chain-swap', 'cross-chain-quote', 'quote', 'swap', 'token-list'])),\n logo_url: z.url(),\n name: z.string(),\n lanes: z.array(z.union([z.coerce.number().int().nonnegative(), Caip2ChainIdSchema])),\n});\n\nconst SupportedChainsResponseItemEvmSchema: z.ZodType<SupportedChainsResponseItemEvm> =\n SupportedChainsResponseItemBaseSchema.extend({\n chainId: z.coerce.number().int().nonnegative(),\n chainType: z.literal('evm'),\n router: EvmAddressSchema.optional(),\n wrapped_token: EvmAddressSchema.optional(),\n recurring: z\n .object({\n minFrequencySeconds: z.number().int().nonnegative(),\n supportedTokens: z.array(\n z.object({\n address: EvmAddressSchema,\n // Decimal string — must be `BigInt()`-parseable (see\n // checkRecurringEligibility's `BigInt(minimumAmount)` call).\n minimumAmount: z.string().regex(/^\\d+$/, 'minimumAmount must be a decimal string'),\n }),\n ),\n })\n .optional(),\n });\n\nconst SupportedChainsResponseItemSvmSchema: z.ZodType<SupportedChainsResponseItemSvm> =\n SupportedChainsResponseItemBaseSchema.extend({\n chainId: z\n .string()\n .refine((value) => isCaip2ChainId(value) && value.startsWith('solana:'), {\n error: 'Is not a valid Solana CAIP-2 ID',\n })\n .transform((value) => value as Caip2ChainId),\n chainType: z.literal('svm'),\n });\n\n/**\n * Schema for the response from Markr's /info/chains endpoint.\n *\n * @see https://orchestrator-docs.markr.io/#/paths/~1info~1chains/get\n */\nexport const SupportedChainsResponseSchema: z.ZodType<SupportedChainsResponse> = z.array(\n z.union([\n SupportedChainsResponseItemEvmSchema,\n SupportedChainsResponseItemSvmSchema,\n SupportedChainsResponseItemBaseSchema.refine(\n (item) => item.chainType !== 'evm' && item.chainType !== 'svm',\n 'Known chain types must match their expected schema',\n ),\n ]),\n);\n\nexport type TokenListResponse = Array<{\n address: EvmAddress;\n decimals: number;\n logo_url: string;\n name: string;\n symbol: string;\n}>;\n\n/**\n * Schema for the response Markr's /tokens/{chainId}/list endpoint.\n *\n * @see https://orchestrator-docs.markr.io/#/paths/~1tokens~1%7BchainId%7D~1list/get\n */\nexport const TokenListResponseSchema: z.ZodType<TokenListResponse> = z.array(\n z.object({\n address: EvmAddressSchema,\n decimals: z.number().int().nonnegative().max(18),\n logo_url: z.url(),\n name: z.string(),\n symbol: z.string(),\n }),\n);\n\nexport interface QuoteResponseData {\n aggregator: {\n id: string;\n logo_url: string;\n name: string;\n };\n amountIn: bigint;\n amountOut: bigint;\n /** Chain identifier (number for EVM chains, CAIP-2 ID for SVM chains) */\n chainId: number | Caip2ChainId;\n expiredAt: number;\n /**\n * Fee breakdown for cross-chain bridge transactions.\n *\n * Only included in quotes from cross-chain aggregators (DeBridge, LiFi).\n */\n fees?: ReadonlyArray<{\n type: 'protocol' | 'gas' | 'bridge' | 'slippage' | 'swap' | 'other' | 'relay';\n /** Human-readable fee name */\n name: string;\n /** Fee amount in token's smallest unit */\n amount: bigint;\n /**\n * Docs document `extra` as `boolean or object`. The boolean form is the\n * legacy \"additive one-time charge\" flag; the object form is reserved\n * for future structured metadata. Consumers should treat any truthy\n * value as \"this fee is on top of the input amount and must be balance-\n * checked separately.\"\n */\n extra?: boolean | Record<string, unknown>;\n /** Token the fee is deducted from */\n token: {\n /** Chain ID where fee is deducted */\n chainId: number | Caip2ChainId;\n /** Token address (EVM hex or Solana base58) */\n address: EvmAddress | SolAddress;\n };\n }>;\n gasEstimate?: bigint;\n recommendedSlippage: number;\n /** Input token address (EVM hex or Solana base58) */\n tokenIn: EvmAddress | SolAddress;\n tokenInDecimals: number;\n /** Output token address (EVM hex or Solana base58) */\n tokenOut: EvmAddress | SolAddress;\n tokenOutDecimals: number;\n uuid: string;\n}\n\nexport interface QuoteResponseDataDone {\n done: true;\n}\n\nexport type QuoteResponse = QuoteResponseData | QuoteResponseDataDone;\n\nconst MarkrQuoteTokenAddressSchema = z.union([EvmAddressSchema, SolAddressSchema, HyperliquidAddressSchema]);\n\n/**\n * Schema for the response from Markr's /quote endpoint.\n *\n * @see https://orchestrator-docs.markr.io/#/paths/~1quote/post\n */\nexport const QuoteResponseSchema: z.ZodType<QuoteResponse> = z.union([\n z.object({\n aggregator: z.object({\n id: z.string(),\n logo_url: z.url(),\n name: z.string(),\n }),\n amountIn: z.coerce.bigint().nonnegative(),\n amountOut: z.coerce.bigint().nonnegative(),\n chainId: z.union([z.number().int().nonnegative(), Caip2ChainIdSchema]),\n /**\n * Unix time in seconds when the quote expires.\n */\n expiredAt: z.number().int().nonnegative(),\n fees: z\n .array(\n z.object({\n type: z.enum(['protocol', 'gas', 'bridge', 'slippage', 'swap', 'other', 'relay']),\n name: z.string(),\n amount: z.coerce.bigint().nonnegative(),\n token: z.object({\n chainId: z.union([z.number().int().nonnegative(), Caip2ChainIdSchema]),\n address: MarkrQuoteTokenAddressSchema,\n }),\n // Docs: `extra: boolean or object` — accept both. The boolean form\n // is the legacy \"is this an additive one-time charge\" flag; the\n // object form is reserved for future structured metadata.\n extra: z.union([z.boolean(), z.record(z.string(), z.unknown())]).optional(),\n }),\n )\n .optional(),\n /**\n * Estimated gas for the swap transaction.\n * Markr estimates already include a buffer.\n *\n * The API docs do not specify this field as optional, but in practice it can be missing.\n */\n gasEstimate: z.coerce.bigint().nonnegative().optional(),\n /** Recommended slippage in basis points. */\n recommendedSlippage: z.number().int().nonnegative(),\n tokenIn: MarkrQuoteTokenAddressSchema,\n tokenInDecimals: z.number().int().nonnegative().max(18),\n tokenOut: MarkrQuoteTokenAddressSchema,\n tokenOutDecimals: z.number().int().nonnegative().max(18),\n uuid: z.uuid(),\n }),\n z.object({\n done: z.literal(true),\n }),\n]);\n\n/**\n * Response type for Markr's /swap, /recurring/swap, and\n * /recurring/orders/{orderId}/cancel endpoints — all return the same\n * `WrappedTransaction` calldata shape per the orchestrator docs.\n *\n * @see https://orchestrator-docs.markr.io/#/paths/~1swap/post\n */\nexport interface WrappedSwapTransactionResponse {\n data: Hex;\n to: EvmAddress;\n value: bigint;\n /**\n * Sender address per the docs' `WrappedTransaction` schema. Optional in\n * the SDK because the caller (the wallet broadcasting the TX) already\n * knows their own from-address and the field has historically been\n * dropped on parse without consumer impact.\n */\n from?: EvmAddress;\n}\n\nexport const WrappedSwapTransactionResponseSchema: z.ZodType<WrappedSwapTransactionResponse> = z.object({\n data: HexSchema,\n to: EvmAddressSchema,\n value: z.coerce.bigint().nonnegative(),\n from: EvmAddressSchema.optional(),\n});\n\n/**\n * Solana swap transaction (returned for SVM chains).\n */\nexport interface SolanaSwapTransactionResponse {\n /** Chain type identifier */\n chainType: 'svm';\n /** Base64-encoded Solana transaction to be signed and sent by the client */\n swapTransaction: string;\n}\n\nexport const SolanaSwapTransactionResponseSchema: z.ZodType<SolanaSwapTransactionResponse> = z.object({\n chainType: z.literal('svm'),\n swapTransaction: z.base64(),\n});\n\n/**\n * `sendAsset` action parameters Relay produces for the deposit step.\n *\n * These are the exact strings the SDK must (a) include in the EIP-712 message\n * it signs and (b) submit verbatim as the `action` body to HL `/exchange`.\n * Keeping them pre-formatted by Relay (rather than reconstructed by the SDK)\n * eliminates drift — notably on `amount`, which Relay formats at the spot\n * token's display precision (e.g. `\"0.200000\"` for USDC, not the perps-side\n * `\"0.20000000\"`). Any mismatch between what we sign / submit and what Relay\n * recorded in the order makes Relay's indexer skip the on-chain `sendAsset`.\n */\nexport interface HyperliquidSendAssetParameters {\n /** `\"Mainnet\"` or `\"Testnet\"`. */\n hyperliquidChain: string;\n /** Relay's HL custodian — where the sendAsset transfers to. */\n destination: EvmAddress;\n /** Currently always `\"\"` for non-DEX withdrawals. */\n sourceDex: string;\n /** Currently always `\"\"` for non-DEX withdrawals. */\n destinationDex: string;\n /** HL `\"{symbol}:{spotEvmContract}\"` (e.g. `\"USDC:0x6d1e…054\"`). */\n token: string;\n /** Human-readable decimal, Relay-formatted at the spot token's display precision. */\n amount: string;\n /** Currently always `\"\"` for non-sub-account withdrawals. */\n fromSubAccount: string;\n}\n\nconst HyperliquidSendAssetParametersSchema: z.ZodType<HyperliquidSendAssetParameters> = z.object({\n hyperliquidChain: z.string().min(1),\n destination: EvmAddressSchema,\n sourceDex: z.string(),\n destinationDex: z.string(),\n token: z.string().min(1),\n amount: z.string().regex(/^\\d+(\\.\\d+)?$/, 'amount must be a positive decimal string'),\n fromSubAccount: z.string(),\n});\n\n/**\n * Pass-through EIP-712 envelope Relay returns inside the v2 swap response.\n *\n * The SDK no longer hardcodes Relay's `RelayNonceMapping` schema — instead it\n * forwards `domain` / `types` / `primaryType` / `value` to the wallet's typed-\n * data signer verbatim. Future Relay-side schema additions (e.g. `depositor`\n * was added in v2) propagate automatically without an SDK release.\n */\nexport interface RelayEip712SignEnvelope {\n signatureKind: 'eip712';\n domain: {\n name: string;\n version: string;\n chainId: number;\n verifyingContract: EvmAddress;\n };\n types: Record<string, ReadonlyArray<{ name: string; type: string }>>;\n primaryType: string;\n /** Relay binds at minimum these fields; additional keys (e.g. `depositor`) are forwarded verbatim. */\n value: {\n wallet: EvmAddress;\n chainId: string;\n id: Hex;\n nonce: number;\n [key: string]: unknown;\n };\n}\n\nconst RelayEip712SignEnvelopeSchema: z.ZodType<RelayEip712SignEnvelope> = z.object({\n signatureKind: z.literal('eip712'),\n domain: z.object({\n name: z.string().min(1),\n version: z.string().min(1),\n chainId: z.number().int().nonnegative(),\n verifyingContract: EvmAddressSchema,\n }),\n types: z.record(z.string(), z.array(z.object({ name: z.string(), type: z.string() }))),\n primaryType: z.string().min(1),\n value: z\n .object({\n wallet: EvmAddressSchema,\n chainId: z.string().min(1),\n id: HashSchema,\n nonce: z.number().int().nonnegative(),\n })\n .loose(),\n});\n\n/**\n * Pass-through `/authorize` POST body Relay returns inside the v2 swap response.\n *\n * The SDK forwards `body` verbatim to Markr (which forwards verbatim to Relay).\n * Markr only normalizes `nonce` to a JSON number on the wire; everything else\n * is untouched, so new fields Relay adds are not rejected.\n */\nexport interface RelayAuthorizeEnvelope {\n endpoint: string;\n method: string;\n body: {\n type: string;\n id: Hex;\n nonce: number;\n wallet: EvmAddress;\n walletChainId: number;\n signatureChainId: number;\n [key: string]: unknown;\n };\n}\n\nconst RelayAuthorizeEnvelopeSchema: z.ZodType<RelayAuthorizeEnvelope> = z.object({\n endpoint: z.string().min(1),\n method: z.string().min(1),\n body: z\n .object({\n type: z.string().min(1),\n id: HashSchema,\n nonce: z.number().int().nonnegative(),\n wallet: EvmAddressSchema,\n walletChainId: z.number().int().nonnegative(),\n signatureChainId: z.number().int().nonnegative(),\n })\n .loose(),\n});\n\n/**\n * Hyperliquid 2-phase withdrawal variant (source chain = `eip155:1337`).\n *\n * Markr returns:\n * - the dynamic envelope (`nonce`, `id`, `requestId`) used for the authorize\n * signature and status polling, and\n * - the full `parameters` object Relay produced for the deposit step's\n * `sendAsset` action, which the SDK signs verbatim and submits to HL.\n *\n * Starting at `protocolVersion: 2`, Relay's full EIP-712 envelope (`sign`) and\n * the `/authorize` POST body (`authorize`) are passed through verbatim — the\n * SDK no longer reconstructs Relay's schemas, so additive Relay changes (e.g.\n * `depositor` field) flow through without an SDK release.\n *\n * Important: `id` and `requestId` are TWO DIFFERENT bytes32s.\n * - `id` is the **order id** — it goes into the EIP-712 `NonceMapping`\n * message and Relay's `/authorize` POST body. Sourced from\n * `steps[0].items[0].data.sign.value.id` (== `data.post.body.id` ==\n * `protocol.v2.orderId`).\n * - `requestId` is the **tracking id** used only for\n * `/intents/status/v3?requestId=…` polling. Sourced from\n * `steps[0].requestId`.\n *\n * Swapping these two looks superficially correct (both are `0x{64hex}`) but\n * makes the on-chain `sendAsset` un-matchable by Relay's indexer.\n *\n * The SDK pins the static HL-side `SendAsset` shape (which HL owns) as a\n * constant in `_hyperliquid-eip712.ts`. Relay's nonce-mapping shape is now\n * dynamic via the `sign` envelope.\n */\nexport interface HyperliquidWithdrawSwapResponse {\n type: 'hyperliquid-withdraw';\n /** SDK validates against `SUPPORTED_HL_PROTOCOL_VERSIONS`; bumps when Relay/HL EIP-712 schemas change. */\n protocolVersion: number;\n /** Shared between authorize + sendAsset signatures; uint64 decimal string. */\n nonce: string;\n /** Order id signed inside the `NonceMapping` message and posted to `/authorize`. */\n id: Hex;\n /** Tracking id for cross-chain status polling (`/intents/status/v3?requestId=…`). */\n requestId: Hex;\n /** Relay-canonical `sendAsset` action parameters; signed and submitted verbatim. */\n parameters: HyperliquidSendAssetParameters;\n /** Relay's full EIP-712 nonce-mapping envelope. v2+. */\n sign?: RelayEip712SignEnvelope;\n /** Relay's `/authorize` POST descriptor (we forward `body` verbatim). v2+. */\n authorize?: RelayAuthorizeEnvelope;\n}\n\nexport const HyperliquidWithdrawSwapResponseSchema: z.ZodType<HyperliquidWithdrawSwapResponse> = z.object({\n type: z.literal('hyperliquid-withdraw'),\n protocolVersion: z.number().int().positive(),\n nonce: z.string().regex(/^\\d+$/, 'nonce must be a decimal string'),\n id: HashSchema,\n requestId: HashSchema,\n parameters: HyperliquidSendAssetParametersSchema,\n sign: RelayEip712SignEnvelopeSchema.optional(),\n authorize: RelayAuthorizeEnvelopeSchema.optional(),\n});\n\nexport type SwapResponse =\n | WrappedSwapTransactionResponse\n | SolanaSwapTransactionResponse\n | HyperliquidWithdrawSwapResponse;\n\nexport const SwapResponseSchema: z.ZodType<SwapResponse> = z.union([\n WrappedSwapTransactionResponseSchema,\n SolanaSwapTransactionResponseSchema,\n HyperliquidWithdrawSwapResponseSchema,\n]);\n\n/**\n * Markr `/authorize` response.\n *\n * The success body is documented as opaque, so we only assert that:\n * 1. the parsed JSON isn't an error envelope (`{ error: \"...\" }`) — Markr's\n * upstream (Relay) can return a 200 with an error payload when the\n * authorize is rejected after HTTP success;\n * 2. nothing else, by design — schema bumps when Markr publishes a spec.\n */\nexport const MarkrAuthorizeResponseSchema: z.ZodType<unknown> = z\n .unknown()\n .refine(\n (data) =>\n !(\n data !== null &&\n typeof data === 'object' &&\n 'error' in data &&\n typeof (data as { error: unknown }).error === 'string'\n ),\n { message: 'Markr /authorize returned an error envelope despite 2xx status.' },\n );\n\nexport interface PartnerInfoResponse {\n /**\n * The partner fee in basis points collected on each swap.\n */\n fee: number;\n name: string;\n}\n\nexport const PartnerInfoResponseSchema: z.ZodType<PartnerInfoResponse> = z.object({\n fee: z.int().nonnegative(),\n name: z.string(),\n});\n\n/**\n * If the destination token is USDC, the flow is:\n * - pending -> committed -> completed\n *\n * If the destination token is not USDC, the flow is:\n * - pending -> committed -> pending_execution -> completed\n *\n * If the transaction fails at any point, the status will be 'failed'.\n */\nexport type CrossChainStatus =\n | /** Transaction submitted to CCIP */\n 'pending'\n /** Message committed, awaiting execution on destination chain */\n | 'committed'\n /** Message received on destination, swap pending execution by relayer */\n | 'pending_execution'\n /** Message executed successfully on destination chain */\n | 'completed'\n /** Swap expired, and funds were refunded (CCIP only) */\n | 'refunded'\n /** Execution failed */\n | 'failed'\n /** Unknown state */\n | 'unknown';\n\nexport interface CrossChainStatusResponse {\n /**\n * Cross-chain transaction identifier.\n *\n * For CCIP: The CCIP message ID.\n * For DeBridge: The DeBridge order ID.\n */\n messageId: string | null;\n /** Current status of the cross-chain transaction. */\n status: CrossChainStatus;\n /** Human-readable status description */\n description: string;\n /** Source chain information */\n sourceChain: {\n /** Source chain network name */\n name: string;\n /** Source chain transaction hash */\n transactionHash: Hash | Signature;\n /** Transaction timestamp on source chain (ISO 8601) */\n timestamp: string;\n /** When the source transaction was finalized (ISO 8601) */\n finalized: string | boolean | null;\n };\n /** Destination chain information */\n destinationChain: {\n /** Destination chain network name */\n name: string | null;\n /**\n * Destination chain tx hash.\n *\n * - For direct transfers (USDC -> USDC): The CCIP bridge transaction hash.\n * - For successful swaps: The actual swap transaction hash from the relayer.\n * - For pending swaps: null (swap not yet executed).\n */\n transactionHash: Hash | Signature | null;\n /**\n * CCIP bridge tx hash (only present for swaps, not direct transfers).\n *\n * This is the transaction that delivered USDC to the destination chain via CCIP.\n * The `transactionHash` field contains the subsequent swap transaction.\n */\n bridgeHash?: Hash | Signature | null;\n /** Transaction timestamp on destination chain (null if not yet executed) (ISO 8601) */\n timestamp: string | null;\n /** When the destination transaction was finalized (null if not yet executed) (ISO 8601) */\n finalized: string | null;\n };\n /** Transaction progress information */\n progress: {\n /** Whether the message has been committed on destination chain */\n committed: boolean;\n /** When the message was committed (null if not committed) (ISO 8601) */\n commitTimestamp?: string | null;\n /** Whether the message has been executed on destination chain */\n executed: boolean;\n };\n /** Fee information */\n fees: {\n /** Fee token address */\n token: EvmAddress | SolAddress | null;\n /** Fee amount in wei */\n amount: bigint | null;\n } | null;\n /** Tokens transferred in this cross-chain transaction */\n transferredTokens: ReadonlyArray<{\n /** Token address */\n token: EvmAddress | SolAddress;\n /** Token amount */\n amount: bigint;\n }>;\n /**\n * Debug information from Markr transaction API (only present for swaps that have been executed).\n *\n * Contains detailed information about the relayer execution, retry attempts, and transaction details.\n */\n debug?: Partial<{\n /** CCIP message ID */\n messageId: string;\n /** Execution status from relayer */\n status: string;\n /** Destination chain name */\n destinationChain: string;\n /** Destination swap transaction hash */\n destinationTxHash: string;\n /** Relay transaction hash */\n relayTxHash: string;\n /** Number of retry attempts */\n retryCount: number;\n /** Timestamp of last retry attempt (ISO 8601) */\n lastRetryAt: string;\n /** Source chain name */\n sourceChain: string;\n /** Source transaction hash */\n sourceTxHash: string;\n /** When the record was created (ISO 8601) */\n createdAt: string;\n }> | null;\n}\n\nconst ISO_8601_TIMEZONE_DESIGNATOR_REGEX = /[zZ]|[+-]\\d{2}:?\\d{2}$/;\n\n// Markr API returns ISO-8601 datetime strings that are sometimes missing a timezone designator (\"local\" ISO).\n// We assume these are meant to be UTC and append 'Z' if missing, then validate as strict ISO-8601 with timezone.\nconst datetime = z.iso\n .datetime({ local: true })\n .refine(\n (value) => {\n // Accept at least local ISO format\n // If missing timezone, treat as UTC\n const hasTimezone = ISO_8601_TIMEZONE_DESIGNATOR_REGEX.test(value);\n const isoString = hasTimezone ? value : `${value}Z`;\n // Validate as strict ISO-8601 with timezone\n return z.iso.datetime().safeParse(isoString).success;\n },\n {\n error: 'Invalid ISO-8601 datetime (must be valid with timezone, or local assumed UTC)',\n },\n )\n .transform((value) => {\n const hasTimezone = ISO_8601_TIMEZONE_DESIGNATOR_REGEX.test(value);\n return hasTimezone ? value : `${value}Z`;\n });\n\nexport const CrossChainStatusResponseSchema: z.ZodType<CrossChainStatusResponse> = z.object({\n messageId: z.string().nullable(),\n status: z.enum(['pending', 'committed', 'pending_execution', 'completed', 'failed', 'refunded', 'unknown']),\n description: z.string(),\n sourceChain: z.object({\n name: z.string(),\n transactionHash: z.union([HashSchema, SolSignatureSchema]),\n timestamp: datetime,\n finalized: datetime.or(z.boolean()).nullable(),\n }),\n destinationChain: z.object({\n name: z.string().nullable(),\n transactionHash: z.union([HashSchema, SolSignatureSchema]).nullable(),\n bridgeHash: z.union([HashSchema, SolSignatureSchema]).nullable().optional(),\n timestamp: datetime.nullable(),\n finalized: datetime.nullable(),\n }),\n progress: z.object({\n committed: z.boolean(),\n commitTimestamp: datetime.nullable().optional(),\n executed: z.boolean(),\n }),\n fees: z\n .object({\n token: z.union([EvmAddressSchema, SolAddressSchema]).nullable(),\n amount: z.coerce.bigint().nonnegative().nullable(),\n })\n .nullable(),\n transferredTokens: z.array(\n z.object({\n token: z.union([EvmAddressSchema, SolAddressSchema]),\n amount: z.coerce.bigint().nonnegative(),\n }),\n ),\n debug: z\n .looseObject({\n messageId: z.string(),\n status: z.string(),\n destinationChain: z.string(),\n destinationTxHash: z.string(),\n relayTxHash: z.string(),\n retryCount: z.number().int().nonnegative(),\n lastRetryAt: z.iso.datetime(),\n sourceChain: z.string(),\n sourceTxHash: z.string(),\n createdAt: z.iso.datetime(),\n })\n .partial()\n .nullable()\n .optional(),\n});\n\nexport interface SpenderAddressResponse {\n address: EvmAddress;\n}\n\nexport const SpenderAddressResponseSchema: z.ZodType<SpenderAddressResponse> = z.object({\n address: EvmAddressSchema,\n});\n"],"mappings":"iJAqEA,MAAa,EAA8CA,EAAAA,EACxD,QAAQ,CACR,OAAQ,GAAUC,EAAAA,eAAe,EAAM,CAAE,CACxC,QAAS,0BACV,CAAC,CACD,UAAW,GAAU,EAAsB,CAExC,EAAwCD,EAAAA,EAAE,OAAO,CACrD,QAASA,EAAAA,EAAE,MAAM,CAACA,EAAAA,EAAE,QAAQ,CAAEA,EAAAA,EAAE,QAAQ,CAAC,CAAC,CAC1C,UAAWA,EAAAA,EAAE,QAAQ,CACrB,iBAAkBA,EAAAA,EAAE,MAAMA,EAAAA,EAAE,KAAK,CAAC,mBAAoB,oBAAqB,QAAS,OAAQ,aAAa,CAAC,CAAC,CAC3G,SAAUA,EAAAA,EAAE,KAAK,CACjB,KAAMA,EAAAA,EAAE,QAAQ,CAChB,MAAOA,EAAAA,EAAE,MAAMA,EAAAA,EAAE,MAAM,CAACA,EAAAA,EAAE,OAAO,QAAQ,CAAC,KAAK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QAASE,EAAAA,iBACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"_schema.cjs","names":["z","isCaip2ChainId","EvmAddressSchema","SolAddressSchema","HyperliquidAddressSchema","HexSchema","HashSchema","SolSignatureSchema"],"sources":["../../../src/transfer-service/markr/_schema.ts"],"sourcesContent":["import type { Signature, Address as SolAddress } from '@solana/kit';\nimport type { Address as EvmAddress, Hash } from 'viem';\nimport { z } from 'zod';\nimport type { Caip2ChainId } from '../../types/caip';\nimport type { Hex } from '../../types/signer';\nimport { isCaip2ChainId } from '../../utils/caip';\nimport {\n EvmAddressSchema,\n HashSchema,\n HexSchema,\n HyperliquidAddressSchema,\n SolAddressSchema,\n SolSignatureSchema,\n} from '../service-schemas';\n\ninterface SupportedChainsResponseItemBase {\n chainId: number | string;\n chainType: string;\n /** Available services on the chain. Each service has specific functionality */\n enabled_services: Array<'cross-chain-swap' | 'cross-chain-quote' | 'quote' | 'swap' | 'token-list'>;\n /** Chain logo URL */\n logo_url: string;\n /** Chain display name */\n name: string;\n /**\n * List of chain IDs that this chain can swap to via cross-chain aggregators.\n *\n * Empty array means no cross-chain routes available.\n */\n lanes: ReadonlyArray<number | Caip2ChainId>;\n}\n\nexport interface SupportedChainsResponseItemEvm extends SupportedChainsResponseItemBase {\n /** Chain identifier */\n chainId: number;\n /** Chain virtual machine type */\n chainType: 'evm';\n /** Router contract address */\n router?: EvmAddress;\n /** Native token wrapped contract address */\n wrapped_token?: EvmAddress;\n /**\n * Recurring-swap (DCA) capability metadata for this chain. Absent when the\n * orchestrator does not enable recurring swaps for the chain.\n *\n * @see https://orchestrator-docs.markr.io/#/Recurring%20Swaps\n */\n recurring?: {\n /** Lower bound for `intervalSeconds` accepted by `/recurring/quote`. */\n minFrequencySeconds: number;\n };\n}\n\nexport interface SupportedChainsResponseItemSvm extends SupportedChainsResponseItemBase {\n /** Chain identifier */\n chainId: Caip2ChainId;\n /** Chain virtual machine type */\n chainType: 'svm';\n}\n\nexport type SupportedChainsResponse = Array<\n SupportedChainsResponseItemEvm | SupportedChainsResponseItemSvm | SupportedChainsResponseItemBase\n>;\n\nexport const Caip2ChainIdSchema: z.ZodType<Caip2ChainId> = z\n .string()\n .refine((value) => isCaip2ChainId(value), {\n message: 'Invalid CAIP-2 chain ID',\n })\n .transform((value) => value as Caip2ChainId);\n\nconst SupportedChainsResponseItemBaseSchema = z.object({\n chainId: z.union([z.number(), z.string()]),\n chainType: z.string(),\n enabled_services: z.array(z.enum(['cross-chain-swap', 'cross-chain-quote', 'quote', 'swap', 'token-list'])),\n logo_url: z.url(),\n name: z.string(),\n lanes: z.array(z.union([z.coerce.number().int().nonnegative(), Caip2ChainIdSchema])),\n});\n\nconst SupportedChainsResponseItemEvmSchema: z.ZodType<SupportedChainsResponseItemEvm> =\n SupportedChainsResponseItemBaseSchema.extend({\n chainId: z.coerce.number().int().nonnegative(),\n chainType: z.literal('evm'),\n router: EvmAddressSchema.optional(),\n wrapped_token: EvmAddressSchema.optional(),\n recurring: z\n .object({\n minFrequencySeconds: z.number().int().nonnegative(),\n })\n .optional(),\n });\n\nconst SupportedChainsResponseItemSvmSchema: z.ZodType<SupportedChainsResponseItemSvm> =\n SupportedChainsResponseItemBaseSchema.extend({\n chainId: z\n .string()\n .refine((value) => isCaip2ChainId(value) && value.startsWith('solana:'), {\n error: 'Is not a valid Solana CAIP-2 ID',\n })\n .transform((value) => value as Caip2ChainId),\n chainType: z.literal('svm'),\n });\n\n/**\n * Schema for the response from Markr's /info/chains endpoint.\n *\n * @see https://orchestrator-docs.markr.io/#/paths/~1info~1chains/get\n */\nexport const SupportedChainsResponseSchema: z.ZodType<SupportedChainsResponse> = z.array(\n z.union([\n SupportedChainsResponseItemEvmSchema,\n SupportedChainsResponseItemSvmSchema,\n SupportedChainsResponseItemBaseSchema.refine(\n (item) => item.chainType !== 'evm' && item.chainType !== 'svm',\n 'Known chain types must match their expected schema',\n ),\n ]),\n);\n\nexport type TokenListResponse = Array<{\n address: EvmAddress;\n decimals: number;\n logo_url: string;\n name: string;\n symbol: string;\n}>;\n\n/**\n * Schema for the response Markr's /tokens/{chainId}/list endpoint.\n *\n * @see https://orchestrator-docs.markr.io/#/paths/~1tokens~1%7BchainId%7D~1list/get\n */\nexport const TokenListResponseSchema: z.ZodType<TokenListResponse> = z.array(\n z.object({\n address: EvmAddressSchema,\n decimals: z.number().int().nonnegative().max(18),\n logo_url: z.url(),\n name: z.string(),\n symbol: z.string(),\n }),\n);\n\nexport interface QuoteResponseData {\n aggregator: {\n id: string;\n logo_url: string;\n name: string;\n };\n amountIn: bigint;\n amountOut: bigint;\n /** Chain identifier (number for EVM chains, CAIP-2 ID for SVM chains) */\n chainId: number | Caip2ChainId;\n expiredAt: number;\n /**\n * Fee breakdown for cross-chain bridge transactions.\n *\n * Only included in quotes from cross-chain aggregators (DeBridge, LiFi).\n */\n fees?: ReadonlyArray<{\n type: 'protocol' | 'gas' | 'bridge' | 'slippage' | 'swap' | 'other' | 'relay';\n /** Human-readable fee name */\n name: string;\n /** Fee amount in token's smallest unit */\n amount: bigint;\n /**\n * Docs document `extra` as `boolean or object`. The boolean form is the\n * legacy \"additive one-time charge\" flag; the object form is reserved\n * for future structured metadata. Consumers should treat any truthy\n * value as \"this fee is on top of the input amount and must be balance-\n * checked separately.\"\n */\n extra?: boolean | Record<string, unknown>;\n /** Token the fee is deducted from */\n token: {\n /** Chain ID where fee is deducted */\n chainId: number | Caip2ChainId;\n /** Token address (EVM hex or Solana base58) */\n address: EvmAddress | SolAddress;\n };\n }>;\n gasEstimate?: bigint;\n recommendedSlippage: number;\n /** Input token address (EVM hex or Solana base58) */\n tokenIn: EvmAddress | SolAddress;\n tokenInDecimals: number;\n /** Output token address (EVM hex or Solana base58) */\n tokenOut: EvmAddress | SolAddress;\n tokenOutDecimals: number;\n uuid: string;\n}\n\nexport interface QuoteResponseDataDone {\n done: true;\n}\n\nexport type QuoteResponse = QuoteResponseData | QuoteResponseDataDone;\n\nconst MarkrQuoteTokenAddressSchema = z.union([EvmAddressSchema, SolAddressSchema, HyperliquidAddressSchema]);\n\n/**\n * Schema for the response from Markr's /quote endpoint.\n *\n * @see https://orchestrator-docs.markr.io/#/paths/~1quote/post\n */\nexport const QuoteResponseSchema: z.ZodType<QuoteResponse> = z.union([\n z.object({\n aggregator: z.object({\n id: z.string(),\n logo_url: z.url(),\n name: z.string(),\n }),\n amountIn: z.coerce.bigint().nonnegative(),\n amountOut: z.coerce.bigint().nonnegative(),\n chainId: z.union([z.number().int().nonnegative(), Caip2ChainIdSchema]),\n /**\n * Unix time in seconds when the quote expires.\n */\n expiredAt: z.number().int().nonnegative(),\n fees: z\n .array(\n z.object({\n type: z.enum(['protocol', 'gas', 'bridge', 'slippage', 'swap', 'other', 'relay']),\n name: z.string(),\n amount: z.coerce.bigint().nonnegative(),\n token: z.object({\n chainId: z.union([z.number().int().nonnegative(), Caip2ChainIdSchema]),\n address: MarkrQuoteTokenAddressSchema,\n }),\n // Docs: `extra: boolean or object` — accept both. The boolean form\n // is the legacy \"is this an additive one-time charge\" flag; the\n // object form is reserved for future structured metadata.\n extra: z.union([z.boolean(), z.record(z.string(), z.unknown())]).optional(),\n }),\n )\n .optional(),\n /**\n * Estimated gas for the swap transaction.\n * Markr estimates already include a buffer.\n *\n * The API docs do not specify this field as optional, but in practice it can be missing.\n */\n gasEstimate: z.coerce.bigint().nonnegative().optional(),\n /** Recommended slippage in basis points. */\n recommendedSlippage: z.number().int().nonnegative(),\n tokenIn: MarkrQuoteTokenAddressSchema,\n tokenInDecimals: z.number().int().nonnegative().max(18),\n tokenOut: MarkrQuoteTokenAddressSchema,\n tokenOutDecimals: z.number().int().nonnegative().max(18),\n uuid: z.uuid(),\n }),\n z.object({\n done: z.literal(true),\n }),\n]);\n\n/**\n * Response type for Markr's /swap, /recurring/swap, and\n * /recurring/orders/{orderId}/cancel endpoints — all return the same\n * `WrappedTransaction` calldata shape per the orchestrator docs.\n *\n * @see https://orchestrator-docs.markr.io/#/paths/~1swap/post\n */\nexport interface WrappedSwapTransactionResponse {\n data: Hex;\n to: EvmAddress;\n value: bigint;\n /**\n * Sender address per the docs' `WrappedTransaction` schema. Optional in\n * the SDK because the caller (the wallet broadcasting the TX) already\n * knows their own from-address and the field has historically been\n * dropped on parse without consumer impact.\n */\n from?: EvmAddress;\n}\n\nexport const WrappedSwapTransactionResponseSchema: z.ZodType<WrappedSwapTransactionResponse> = z.object({\n data: HexSchema,\n to: EvmAddressSchema,\n value: z.coerce.bigint().nonnegative(),\n from: EvmAddressSchema.optional(),\n});\n\n/**\n * Solana swap transaction (returned for SVM chains).\n */\nexport interface SolanaSwapTransactionResponse {\n /** Chain type identifier */\n chainType: 'svm';\n /** Base64-encoded Solana transaction to be signed and sent by the client */\n swapTransaction: string;\n}\n\nexport const SolanaSwapTransactionResponseSchema: z.ZodType<SolanaSwapTransactionResponse> = z.object({\n chainType: z.literal('svm'),\n swapTransaction: z.base64(),\n});\n\n/**\n * `sendAsset` action parameters Relay produces for the deposit step.\n *\n * These are the exact strings the SDK must (a) include in the EIP-712 message\n * it signs and (b) submit verbatim as the `action` body to HL `/exchange`.\n * Keeping them pre-formatted by Relay (rather than reconstructed by the SDK)\n * eliminates drift — notably on `amount`, which Relay formats at the spot\n * token's display precision (e.g. `\"0.200000\"` for USDC, not the perps-side\n * `\"0.20000000\"`). Any mismatch between what we sign / submit and what Relay\n * recorded in the order makes Relay's indexer skip the on-chain `sendAsset`.\n */\nexport interface HyperliquidSendAssetParameters {\n /** `\"Mainnet\"` or `\"Testnet\"`. */\n hyperliquidChain: string;\n /** Relay's HL custodian — where the sendAsset transfers to. */\n destination: EvmAddress;\n /** Currently always `\"\"` for non-DEX withdrawals. */\n sourceDex: string;\n /** Currently always `\"\"` for non-DEX withdrawals. */\n destinationDex: string;\n /** HL `\"{symbol}:{spotEvmContract}\"` (e.g. `\"USDC:0x6d1e…054\"`). */\n token: string;\n /** Human-readable decimal, Relay-formatted at the spot token's display precision. */\n amount: string;\n /** Currently always `\"\"` for non-sub-account withdrawals. */\n fromSubAccount: string;\n}\n\nconst HyperliquidSendAssetParametersSchema: z.ZodType<HyperliquidSendAssetParameters> = z.object({\n hyperliquidChain: z.string().min(1),\n destination: EvmAddressSchema,\n sourceDex: z.string(),\n destinationDex: z.string(),\n token: z.string().min(1),\n amount: z.string().regex(/^\\d+(\\.\\d+)?$/, 'amount must be a positive decimal string'),\n fromSubAccount: z.string(),\n});\n\n/**\n * Pass-through EIP-712 envelope Relay returns inside the v2 swap response.\n *\n * The SDK no longer hardcodes Relay's `RelayNonceMapping` schema — instead it\n * forwards `domain` / `types` / `primaryType` / `value` to the wallet's typed-\n * data signer verbatim. Future Relay-side schema additions (e.g. `depositor`\n * was added in v2) propagate automatically without an SDK release.\n */\nexport interface RelayEip712SignEnvelope {\n signatureKind: 'eip712';\n domain: {\n name: string;\n version: string;\n chainId: number;\n verifyingContract: EvmAddress;\n };\n types: Record<string, ReadonlyArray<{ name: string; type: string }>>;\n primaryType: string;\n /** Relay binds at minimum these fields; additional keys (e.g. `depositor`) are forwarded verbatim. */\n value: {\n wallet: EvmAddress;\n chainId: string;\n id: Hex;\n nonce: number;\n [key: string]: unknown;\n };\n}\n\nconst RelayEip712SignEnvelopeSchema: z.ZodType<RelayEip712SignEnvelope> = z.object({\n signatureKind: z.literal('eip712'),\n domain: z.object({\n name: z.string().min(1),\n version: z.string().min(1),\n chainId: z.number().int().nonnegative(),\n verifyingContract: EvmAddressSchema,\n }),\n types: z.record(z.string(), z.array(z.object({ name: z.string(), type: z.string() }))),\n primaryType: z.string().min(1),\n value: z\n .object({\n wallet: EvmAddressSchema,\n chainId: z.string().min(1),\n id: HashSchema,\n nonce: z.number().int().nonnegative(),\n })\n .loose(),\n});\n\n/**\n * Pass-through `/authorize` POST body Relay returns inside the v2 swap response.\n *\n * The SDK forwards `body` verbatim to Markr (which forwards verbatim to Relay).\n * Markr only normalizes `nonce` to a JSON number on the wire; everything else\n * is untouched, so new fields Relay adds are not rejected.\n */\nexport interface RelayAuthorizeEnvelope {\n endpoint: string;\n method: string;\n body: {\n type: string;\n id: Hex;\n nonce: number;\n wallet: EvmAddress;\n walletChainId: number;\n signatureChainId: number;\n [key: string]: unknown;\n };\n}\n\nconst RelayAuthorizeEnvelopeSchema: z.ZodType<RelayAuthorizeEnvelope> = z.object({\n endpoint: z.string().min(1),\n method: z.string().min(1),\n body: z\n .object({\n type: z.string().min(1),\n id: HashSchema,\n nonce: z.number().int().nonnegative(),\n wallet: EvmAddressSchema,\n walletChainId: z.number().int().nonnegative(),\n signatureChainId: z.number().int().nonnegative(),\n })\n .loose(),\n});\n\n/**\n * Hyperliquid 2-phase withdrawal variant (source chain = `eip155:1337`).\n *\n * Markr returns:\n * - the dynamic envelope (`nonce`, `id`, `requestId`) used for the authorize\n * signature and status polling, and\n * - the full `parameters` object Relay produced for the deposit step's\n * `sendAsset` action, which the SDK signs verbatim and submits to HL.\n *\n * Starting at `protocolVersion: 2`, Relay's full EIP-712 envelope (`sign`) and\n * the `/authorize` POST body (`authorize`) are passed through verbatim — the\n * SDK no longer reconstructs Relay's schemas, so additive Relay changes (e.g.\n * `depositor` field) flow through without an SDK release.\n *\n * Important: `id` and `requestId` are TWO DIFFERENT bytes32s.\n * - `id` is the **order id** — it goes into the EIP-712 `NonceMapping`\n * message and Relay's `/authorize` POST body. Sourced from\n * `steps[0].items[0].data.sign.value.id` (== `data.post.body.id` ==\n * `protocol.v2.orderId`).\n * - `requestId` is the **tracking id** used only for\n * `/intents/status/v3?requestId=…` polling. Sourced from\n * `steps[0].requestId`.\n *\n * Swapping these two looks superficially correct (both are `0x{64hex}`) but\n * makes the on-chain `sendAsset` un-matchable by Relay's indexer.\n *\n * The SDK pins the static HL-side `SendAsset` shape (which HL owns) as a\n * constant in `_hyperliquid-eip712.ts`. Relay's nonce-mapping shape is now\n * dynamic via the `sign` envelope.\n */\nexport interface HyperliquidWithdrawSwapResponse {\n type: 'hyperliquid-withdraw';\n /** SDK validates against `SUPPORTED_HL_PROTOCOL_VERSIONS`; bumps when Relay/HL EIP-712 schemas change. */\n protocolVersion: number;\n /** Shared between authorize + sendAsset signatures; uint64 decimal string. */\n nonce: string;\n /** Order id signed inside the `NonceMapping` message and posted to `/authorize`. */\n id: Hex;\n /** Tracking id for cross-chain status polling (`/intents/status/v3?requestId=…`). */\n requestId: Hex;\n /** Relay-canonical `sendAsset` action parameters; signed and submitted verbatim. */\n parameters: HyperliquidSendAssetParameters;\n /** Relay's full EIP-712 nonce-mapping envelope. v2+. */\n sign?: RelayEip712SignEnvelope;\n /** Relay's `/authorize` POST descriptor (we forward `body` verbatim). v2+. */\n authorize?: RelayAuthorizeEnvelope;\n}\n\nexport const HyperliquidWithdrawSwapResponseSchema: z.ZodType<HyperliquidWithdrawSwapResponse> = z.object({\n type: z.literal('hyperliquid-withdraw'),\n protocolVersion: z.number().int().positive(),\n nonce: z.string().regex(/^\\d+$/, 'nonce must be a decimal string'),\n id: HashSchema,\n requestId: HashSchema,\n parameters: HyperliquidSendAssetParametersSchema,\n sign: RelayEip712SignEnvelopeSchema.optional(),\n authorize: RelayAuthorizeEnvelopeSchema.optional(),\n});\n\nexport type SwapResponse =\n | WrappedSwapTransactionResponse\n | SolanaSwapTransactionResponse\n | HyperliquidWithdrawSwapResponse;\n\nexport const SwapResponseSchema: z.ZodType<SwapResponse> = z.union([\n WrappedSwapTransactionResponseSchema,\n SolanaSwapTransactionResponseSchema,\n HyperliquidWithdrawSwapResponseSchema,\n]);\n\n/**\n * Markr `/authorize` response.\n *\n * The success body is documented as opaque, so we only assert that:\n * 1. the parsed JSON isn't an error envelope (`{ error: \"...\" }`) — Markr's\n * upstream (Relay) can return a 200 with an error payload when the\n * authorize is rejected after HTTP success;\n * 2. nothing else, by design — schema bumps when Markr publishes a spec.\n */\nexport const MarkrAuthorizeResponseSchema: z.ZodType<unknown> = z\n .unknown()\n .refine(\n (data) =>\n !(\n data !== null &&\n typeof data === 'object' &&\n 'error' in data &&\n typeof (data as { error: unknown }).error === 'string'\n ),\n { message: 'Markr /authorize returned an error envelope despite 2xx status.' },\n );\n\nexport interface PartnerInfoResponse {\n /**\n * The partner fee in basis points collected on each swap.\n */\n fee: number;\n name: string;\n}\n\nexport const PartnerInfoResponseSchema: z.ZodType<PartnerInfoResponse> = z.object({\n fee: z.int().nonnegative(),\n name: z.string(),\n});\n\n/**\n * If the destination token is USDC, the flow is:\n * - pending -> committed -> completed\n *\n * If the destination token is not USDC, the flow is:\n * - pending -> committed -> pending_execution -> completed\n *\n * If the transaction fails at any point, the status will be 'failed'.\n */\nexport type CrossChainStatus =\n | /** Transaction submitted to CCIP */\n 'pending'\n /** Message committed, awaiting execution on destination chain */\n | 'committed'\n /** Message received on destination, swap pending execution by relayer */\n | 'pending_execution'\n /** Message executed successfully on destination chain */\n | 'completed'\n /** Swap expired, and funds were refunded (CCIP only) */\n | 'refunded'\n /** Execution failed */\n | 'failed'\n /** Unknown state */\n | 'unknown';\n\nexport interface CrossChainStatusResponse {\n /**\n * Cross-chain transaction identifier.\n *\n * For CCIP: The CCIP message ID.\n * For DeBridge: The DeBridge order ID.\n */\n messageId: string | null;\n /** Current status of the cross-chain transaction. */\n status: CrossChainStatus;\n /** Human-readable status description */\n description: string;\n /** Source chain information */\n sourceChain: {\n /** Source chain network name */\n name: string;\n /** Source chain transaction hash */\n transactionHash: Hash | Signature;\n /** Transaction timestamp on source chain (ISO 8601) */\n timestamp: string;\n /** When the source transaction was finalized (ISO 8601) */\n finalized: string | boolean | null;\n };\n /** Destination chain information */\n destinationChain: {\n /** Destination chain network name */\n name: string | null;\n /**\n * Destination chain tx hash.\n *\n * - For direct transfers (USDC -> USDC): The CCIP bridge transaction hash.\n * - For successful swaps: The actual swap transaction hash from the relayer.\n * - For pending swaps: null (swap not yet executed).\n */\n transactionHash: Hash | Signature | null;\n /**\n * CCIP bridge tx hash (only present for swaps, not direct transfers).\n *\n * This is the transaction that delivered USDC to the destination chain via CCIP.\n * The `transactionHash` field contains the subsequent swap transaction.\n */\n bridgeHash?: Hash | Signature | null;\n /** Transaction timestamp on destination chain (null if not yet executed) (ISO 8601) */\n timestamp: string | null;\n /** When the destination transaction was finalized (null if not yet executed) (ISO 8601) */\n finalized: string | null;\n };\n /** Transaction progress information */\n progress: {\n /** Whether the message has been committed on destination chain */\n committed: boolean;\n /** When the message was committed (null if not committed) (ISO 8601) */\n commitTimestamp?: string | null;\n /** Whether the message has been executed on destination chain */\n executed: boolean;\n };\n /** Fee information */\n fees: {\n /** Fee token address */\n token: EvmAddress | SolAddress | null;\n /** Fee amount in wei */\n amount: bigint | null;\n } | null;\n /** Tokens transferred in this cross-chain transaction */\n transferredTokens: ReadonlyArray<{\n /** Token address */\n token: EvmAddress | SolAddress;\n /** Token amount */\n amount: bigint;\n }>;\n /**\n * Debug information from Markr transaction API (only present for swaps that have been executed).\n *\n * Contains detailed information about the relayer execution, retry attempts, and transaction details.\n */\n debug?: Partial<{\n /** CCIP message ID */\n messageId: string;\n /** Execution status from relayer */\n status: string;\n /** Destination chain name */\n destinationChain: string;\n /** Destination swap transaction hash */\n destinationTxHash: string;\n /** Relay transaction hash */\n relayTxHash: string;\n /** Number of retry attempts */\n retryCount: number;\n /** Timestamp of last retry attempt (ISO 8601) */\n lastRetryAt: string;\n /** Source chain name */\n sourceChain: string;\n /** Source transaction hash */\n sourceTxHash: string;\n /** When the record was created (ISO 8601) */\n createdAt: string;\n }> | null;\n}\n\nconst ISO_8601_TIMEZONE_DESIGNATOR_REGEX = /[zZ]|[+-]\\d{2}:?\\d{2}$/;\n\n// Markr API returns ISO-8601 datetime strings that are sometimes missing a timezone designator (\"local\" ISO).\n// We assume these are meant to be UTC and append 'Z' if missing, then validate as strict ISO-8601 with timezone.\nconst datetime = z.iso\n .datetime({ local: true })\n .refine(\n (value) => {\n // Accept at least local ISO format\n // If missing timezone, treat as UTC\n const hasTimezone = ISO_8601_TIMEZONE_DESIGNATOR_REGEX.test(value);\n const isoString = hasTimezone ? value : `${value}Z`;\n // Validate as strict ISO-8601 with timezone\n return z.iso.datetime().safeParse(isoString).success;\n },\n {\n error: 'Invalid ISO-8601 datetime (must be valid with timezone, or local assumed UTC)',\n },\n )\n .transform((value) => {\n const hasTimezone = ISO_8601_TIMEZONE_DESIGNATOR_REGEX.test(value);\n return hasTimezone ? value : `${value}Z`;\n });\n\nexport const CrossChainStatusResponseSchema: z.ZodType<CrossChainStatusResponse> = z.object({\n messageId: z.string().nullable(),\n status: z.enum(['pending', 'committed', 'pending_execution', 'completed', 'failed', 'refunded', 'unknown']),\n description: z.string(),\n sourceChain: z.object({\n name: z.string(),\n transactionHash: z.union([HashSchema, SolSignatureSchema]),\n timestamp: datetime,\n finalized: datetime.or(z.boolean()).nullable(),\n }),\n destinationChain: z.object({\n name: z.string().nullable(),\n transactionHash: z.union([HashSchema, SolSignatureSchema]).nullable(),\n bridgeHash: z.union([HashSchema, SolSignatureSchema]).nullable().optional(),\n timestamp: datetime.nullable(),\n finalized: datetime.nullable(),\n }),\n progress: z.object({\n committed: z.boolean(),\n commitTimestamp: datetime.nullable().optional(),\n executed: z.boolean(),\n }),\n fees: z\n .object({\n token: z.union([EvmAddressSchema, SolAddressSchema]).nullable(),\n amount: z.coerce.bigint().nonnegative().nullable(),\n })\n .nullable(),\n transferredTokens: z.array(\n z.object({\n token: z.union([EvmAddressSchema, SolAddressSchema]),\n amount: z.coerce.bigint().nonnegative(),\n }),\n ),\n debug: z\n .looseObject({\n messageId: z.string(),\n status: z.string(),\n destinationChain: z.string(),\n destinationTxHash: z.string(),\n relayTxHash: z.string(),\n retryCount: z.number().int().nonnegative(),\n lastRetryAt: z.iso.datetime(),\n sourceChain: z.string(),\n sourceTxHash: z.string(),\n createdAt: z.iso.datetime(),\n })\n .partial()\n .nullable()\n .optional(),\n});\n\nexport interface SpenderAddressResponse {\n address: EvmAddress;\n}\n\nexport const SpenderAddressResponseSchema: z.ZodType<SpenderAddressResponse> = z.object({\n address: EvmAddressSchema,\n});\n"],"mappings":"iJAgEA,MAAa,EAA8CA,EAAAA,EACxD,QAAQ,CACR,OAA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CAC5B,kBAAmBA,EAAAA,EAAE,QAAQ,CAC7B,YAAaA,EAAAA,EAAE,QAAQ,CACvB,WAAYA,EAAAA,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa,CAC1C,YAAaA,EAAAA,EAAE,IAAI,UAAU,CAC7B,YAAaA,EAAAA,EAAE,QAAQ,CACvB,aAAcA,EAAAA,EAAE,QAAQ,CACxB,UAAWA,EAAAA,EAAE,IAAI,UAAU,CAC5B,CAAC,CACD,SAAS,CACT,UAAU,CACV,UAAU,CACd,CAAC,CAMW,EAAkEA,EAAAA,EAAE,OAAO,CACtF,QAASE,EAAAA,iBACV,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isCaip2ChainId as e}from"../../utils/caip.js";import{EvmAddressSchema as t,HashSchema as n,HexSchema as r,HyperliquidAddressSchema as i,SolAddressSchema as a,SolSignatureSchema as o}from"../service-schemas.js";import{z as s}from"zod";const c=s.string().refine(t=>e(t),{message:`Invalid CAIP-2 chain ID`}).transform(e=>e),l=s.object({chainId:s.union([s.number(),s.string()]),chainType:s.string(),enabled_services:s.array(s.enum([`cross-chain-swap`,`cross-chain-quote`,`quote`,`swap`,`token-list`])),logo_url:s.url(),name:s.string(),lanes:s.array(s.union([s.coerce.number().int().nonnegative(),c]))}),u=l.extend({chainId:s.coerce.number().int().nonnegative(),chainType:s.literal(`evm`),router:t.optional(),wrapped_token:t.optional(),recurring:s.object({minFrequencySeconds:s.number().int().nonnegative()
|
|
1
|
+
import{isCaip2ChainId as e}from"../../utils/caip.js";import{EvmAddressSchema as t,HashSchema as n,HexSchema as r,HyperliquidAddressSchema as i,SolAddressSchema as a,SolSignatureSchema as o}from"../service-schemas.js";import{z as s}from"zod";const c=s.string().refine(t=>e(t),{message:`Invalid CAIP-2 chain ID`}).transform(e=>e),l=s.object({chainId:s.union([s.number(),s.string()]),chainType:s.string(),enabled_services:s.array(s.enum([`cross-chain-swap`,`cross-chain-quote`,`quote`,`swap`,`token-list`])),logo_url:s.url(),name:s.string(),lanes:s.array(s.union([s.coerce.number().int().nonnegative(),c]))}),u=l.extend({chainId:s.coerce.number().int().nonnegative(),chainType:s.literal(`evm`),router:t.optional(),wrapped_token:t.optional(),recurring:s.object({minFrequencySeconds:s.number().int().nonnegative()}).optional()}),d=l.extend({chainId:s.string().refine(t=>e(t)&&t.startsWith(`solana:`),{error:`Is not a valid Solana CAIP-2 ID`}).transform(e=>e),chainType:s.literal(`svm`)}),f=s.array(s.union([u,d,l.refine(e=>e.chainType!==`evm`&&e.chainType!==`svm`,`Known chain types must match their expected schema`)])),p=s.array(s.object({address:t,decimals:s.number().int().nonnegative().max(18),logo_url:s.url(),name:s.string(),symbol:s.string()})),m=s.union([t,a,i]),h=s.union([s.object({aggregator:s.object({id:s.string(),logo_url:s.url(),name:s.string()}),amountIn:s.coerce.bigint().nonnegative(),amountOut:s.coerce.bigint().nonnegative(),chainId:s.union([s.number().int().nonnegative(),c]),expiredAt:s.number().int().nonnegative(),fees:s.array(s.object({type:s.enum([`protocol`,`gas`,`bridge`,`slippage`,`swap`,`other`,`relay`]),name:s.string(),amount:s.coerce.bigint().nonnegative(),token:s.object({chainId:s.union([s.number().int().nonnegative(),c]),address:m}),extra:s.union([s.boolean(),s.record(s.string(),s.unknown())]).optional()})).optional(),gasEstimate:s.coerce.bigint().nonnegative().optional(),recommendedSlippage:s.number().int().nonnegative(),tokenIn:m,tokenInDecimals:s.number().int().nonnegative().max(18),tokenOut:m,tokenOutDecimals:s.number().int().nonnegative().max(18),uuid:s.uuid()}),s.object({done:s.literal(!0)})]),g=s.object({data:r,to:t,value:s.coerce.bigint().nonnegative(),from:t.optional()}),_=s.object({chainType:s.literal(`svm`),swapTransaction:s.base64()}),v=s.object({hyperliquidChain:s.string().min(1),destination:t,sourceDex:s.string(),destinationDex:s.string(),token:s.string().min(1),amount:s.string().regex(/^\d+(\.\d+)?$/,`amount must be a positive decimal string`),fromSubAccount:s.string()}),y=s.object({signatureKind:s.literal(`eip712`),domain:s.object({name:s.string().min(1),version:s.string().min(1),chainId:s.number().int().nonnegative(),verifyingContract:t}),types:s.record(s.string(),s.array(s.object({name:s.string(),type:s.string()}))),primaryType:s.string().min(1),value:s.object({wallet:t,chainId:s.string().min(1),id:n,nonce:s.number().int().nonnegative()}).loose()}),b=s.object({endpoint:s.string().min(1),method:s.string().min(1),body:s.object({type:s.string().min(1),id:n,nonce:s.number().int().nonnegative(),wallet:t,walletChainId:s.number().int().nonnegative(),signatureChainId:s.number().int().nonnegative()}).loose()}),x=s.object({type:s.literal(`hyperliquid-withdraw`),protocolVersion:s.number().int().positive(),nonce:s.string().regex(/^\d+$/,`nonce must be a decimal string`),id:n,requestId:n,parameters:v,sign:y.optional(),authorize:b.optional()}),S=s.union([g,_,x]),C=s.unknown().refine(e=>!(typeof e==`object`&&e&&`error`in e&&typeof e.error==`string`),{message:`Markr /authorize returned an error envelope despite 2xx status.`}),w=s.object({fee:s.int().nonnegative(),name:s.string()}),T=/[zZ]|[+-]\d{2}:?\d{2}$/,E=s.iso.datetime({local:!0}).refine(e=>{let t=T.test(e)?e:`${e}Z`;return s.iso.datetime().safeParse(t).success},{error:`Invalid ISO-8601 datetime (must be valid with timezone, or local assumed UTC)`}).transform(e=>T.test(e)?e:`${e}Z`),D=s.object({messageId:s.string().nullable(),status:s.enum([`pending`,`committed`,`pending_execution`,`completed`,`failed`,`refunded`,`unknown`]),description:s.string(),sourceChain:s.object({name:s.string(),transactionHash:s.union([n,o]),timestamp:E,finalized:E.or(s.boolean()).nullable()}),destinationChain:s.object({name:s.string().nullable(),transactionHash:s.union([n,o]).nullable(),bridgeHash:s.union([n,o]).nullable().optional(),timestamp:E.nullable(),finalized:E.nullable()}),progress:s.object({committed:s.boolean(),commitTimestamp:E.nullable().optional(),executed:s.boolean()}),fees:s.object({token:s.union([t,a]).nullable(),amount:s.coerce.bigint().nonnegative().nullable()}).nullable(),transferredTokens:s.array(s.object({token:s.union([t,a]),amount:s.coerce.bigint().nonnegative()})),debug:s.looseObject({messageId:s.string(),status:s.string(),destinationChain:s.string(),destinationTxHash:s.string(),relayTxHash:s.string(),retryCount:s.number().int().nonnegative(),lastRetryAt:s.iso.datetime(),sourceChain:s.string(),sourceTxHash:s.string(),createdAt:s.iso.datetime()}).partial().nullable().optional()}),O=s.object({address:t});export{D as CrossChainStatusResponseSchema,C as MarkrAuthorizeResponseSchema,w as PartnerInfoResponseSchema,h as QuoteResponseSchema,O as SpenderAddressResponseSchema,f as SupportedChainsResponseSchema,S as SwapResponseSchema,p as TokenListResponseSchema,g as WrappedSwapTransactionResponseSchema};
|
|
2
2
|
//# sourceMappingURL=_schema.js.map
|