UNPKG

@tristeroresearch/mach-sdk

Version:

A TypeScript SDK for integrating with Mach's API.

72 lines (71 loc) 5.26 kB
/** * @module constants * @description Error constants */ export var ErrorName; (function (ErrorName) { ErrorName["RPCError"] = "RPCError"; ErrorName["ServerError"] = "ServerError"; ErrorName["TransactionError"] = "TransactionError"; ErrorName["ValidationError"] = "ValidationError"; ErrorName["BalanceError"] = "BalanceError"; ErrorName["NotFoundError"] = "NotFoundError"; ErrorName["UnknownError"] = "UnknownError"; ErrorName["SlippageError"] = "SlippageError"; ErrorName["HTTPError"] = "HTTPError"; ErrorName["WalletAddressZero"] = "WalletAddressZero"; ErrorName["FailedToFetchConfig"] = "FailedToFetchConfig"; ErrorName["FailedToFetchGasRecommendation"] = "FailedToFetchGasRecommendation"; ErrorName["RpcError"] = "RpcError"; ErrorName["InvalidChainForMode"] = "InvalidChainForMode"; ErrorName["FailedToCreateWalletClients"] = "FailedToCreateWalletClients"; ErrorName["NoWalletAddress"] = "NoWalletAddress"; })(ErrorName || (ErrorName = {})); export var MachErrorCode; (function (MachErrorCode) { MachErrorCode[MachErrorCode["InternalError"] = 1000] = "InternalError"; MachErrorCode[MachErrorCode["ValidationError"] = 1001] = "ValidationError"; MachErrorCode[MachErrorCode["TransactionUnderpriced"] = 1002] = "TransactionUnderpriced"; MachErrorCode[MachErrorCode["TransactionFailed"] = 1003] = "TransactionFailed"; MachErrorCode[MachErrorCode["Timeout"] = 1004] = "Timeout"; MachErrorCode[MachErrorCode["NotFound"] = 1005] = "NotFound"; MachErrorCode[MachErrorCode["GasLimitError"] = 1006] = "GasLimitError"; MachErrorCode[MachErrorCode["SignatureRejected"] = 1007] = "SignatureRejected"; MachErrorCode[MachErrorCode["BalanceError"] = 1008] = "BalanceError"; MachErrorCode[MachErrorCode["AllowanceRequired"] = 1009] = "AllowanceRequired"; MachErrorCode[MachErrorCode["InsufficientFunds"] = 1010] = "InsufficientFunds"; MachErrorCode[MachErrorCode["TransactionExpired"] = 1011] = "TransactionExpired"; MachErrorCode[MachErrorCode["FailedToFetchGasRecommendation"] = 1012] = "FailedToFetchGasRecommendation"; MachErrorCode[MachErrorCode["FailedToFetchConfig"] = 1013] = "FailedToFetchConfig"; })(MachErrorCode || (MachErrorCode = {})); export var ErrorMessage; (function (ErrorMessage) { ErrorMessage["UnknownError"] = "Unknown error occurred."; ErrorMessage["SlippageError"] = "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote."; ErrorMessage["GasLimitLow"] = "Gas limit is too low."; ErrorMessage["WalletAddressZero"] = "Wallet address is zero. Check wallet initialization."; ErrorMessage["AccountAddressZero"] = "Account address is zero. Check wallet initialization."; ErrorMessage["FailedToFetchConfig"] = "Failed to fetch remote config"; ErrorMessage["FailedToFetchTokenBalance"] = "Failed to fetch token balance"; ErrorMessage["ContractDoesNotHaveReadFunction"] = "Contract does not have a read function - May have failed to get the contract or the provided ABI may be wrong"; ErrorMessage["PrivateKeyNotSet"] = "process.env.PRIVATE_KEY is not set. Order requires a private key in the environment."; ErrorMessage["TransactionOnDifferentChain"] = "Transaction is on a different chain than the source chain."; ErrorMessage["PrivateKeyNotPassed"] = "Please pass your private key to set the wallet clients for the SDK (your private key is not stored!)"; ErrorMessage["NetworkParameterMissing"] = "Required parameter \"network\" is missing."; ErrorMessage["WalletParameterMissing"] = "Required parameter \"wallet\" is missing."; ErrorMessage["NoOrderPlacedLogsFoundInTxReceipt"] = "no OrderPlaced logs found in tx receipt"; ErrorMessage["NoOrderFoundInTxReceipt"] = "No order was found for this transaction. Please ensure the transaction was successful and contains an order."; ErrorMessage["GasFeeTooLow"] = "The provided gas fee is too low for current network conditions. Please increase the gas fee to meet the base fee requirements. See "; ErrorMessage["TransactionNotFound"] = "Transaction not found when attempting to market make. Please ensure the transaction was successful and contains a valid order."; ErrorMessage["TransactionUnderpriced"] = "Transaction is underpriced. Please increase the gas fee to meet the base fee requirements."; ErrorMessage["FailedToFetchGasRecommendation"] = "Failed to fetch gas recommendation. Please try again later."; ErrorMessage["FailedToFetchQuote"] = "Failed to fetch quote for the provided parameters. Please try again."; ErrorMessage["TokenNotFound"] = "Token not found in available tokens. Please check the token address."; ErrorMessage["DollarConversionFailed"] = "Failed to convert dollar value to token amount."; ErrorMessage["InvalidChainForMode"] = "Invalid chain for current network mode"; ErrorMessage["RpcError"] = "RPC Error"; ErrorMessage["TransactionError"] = "Transaction Error"; ErrorMessage["ValidationError"] = "Validation Error"; ErrorMessage["FailedToCreateWalletClients"] = "Failed to create wallet clients"; ErrorMessage["NoWalletAddress"] = "No wallet address found"; })(ErrorMessage || (ErrorMessage = {}));