@swapkit/api
Advanced tools
Comparing version 1.0.0-rc.65 to 1.0.0-rc.66
@@ -152,74 +152,13 @@ var __defProp = Object.defineProperty; | ||
} | ||
} | ||
}); | ||
import {RequestClient as RequestClient3} from "@swapkit/helpers"; | ||
function getCachedPrices({ tokens, ...options }) { | ||
const body = new URLSearchParams; | ||
const filteredTokens = tokens.filter((token, index, sourceArr) => sourceArr.findIndex((t) => t === token) === index); | ||
for (const token of filteredTokens) { | ||
body.append("tokens", JSON.stringify(token)); | ||
} | ||
if (options.metadata) | ||
body.append("metadata", "true"); | ||
if (options.lookup) | ||
body.append("lookup", "true"); | ||
if (options.sparkline) | ||
body.append("sparkline", "true"); | ||
return RequestClient3.post(`${baseUrl3}/tokenlist/cached-price`, { | ||
body: body.toString(), | ||
headers: { "Content-Type": "application/x-www-form-urlencoded" } | ||
}); | ||
} | ||
function getSwapQuote(searchParams) { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/tokens/quote`, { searchParams }); | ||
} | ||
function getBorrowQuote(searchParams) { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/lending/borrow`, { | ||
searchParams | ||
}); | ||
} | ||
function getRepayQuote(searchParams) { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/lending/repay`, { searchParams }); | ||
} | ||
function getLendingAssets() { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/lending/assets`); | ||
} | ||
function getLoans(searchParams) { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/lending/loans`, { searchParams }); | ||
} | ||
function getGasRates() { | ||
return RequestClient3.get(`${baseUrl3}/resource-worker/gasPrice/getAll`); | ||
} | ||
function getTxnDetails(txHash) { | ||
return RequestClient3.get(`${baseUrl3}/apiusage/v2/txn`, { searchParams: { txHash } }); | ||
} | ||
function getTokenListProviders() { | ||
return RequestClient3.get(`${baseUrl3}/tokenlist/providers`); | ||
} | ||
var baseUrl3 = "https://api.thorswap.finance"; | ||
// src/thorswapStatic/endpoints.ts | ||
var exports_endpoints4 = {}; | ||
__export(exports_endpoints4, { | ||
getTokenList: () => { | ||
{ | ||
return getTokenList; | ||
} | ||
}, | ||
getLogoForAsset: () => { | ||
RequestClient: () => { | ||
{ | ||
return getLogoForAsset; | ||
return RequestClient3; | ||
} | ||
} | ||
}); | ||
import {RequestClient as RequestClient4} from "@swapkit/helpers"; | ||
function getTokenList(tokenListName) { | ||
return RequestClient4.get(`${baseUrl4}/token-list/${tokenListName}.json`); | ||
} | ||
function getLogoForAsset(assetString) { | ||
return `${baseUrl4}/token-list/images/${assetString.toLowerCase()}.png`; | ||
} | ||
var baseUrl4 = "https://static.thorswap.finance"; | ||
import {RequestClient as BaseRequestClient} from "@swapkit/helpers"; | ||
// src/thorswapApi/types.ts | ||
import {z} from "zod"; | ||
var TransactionType; | ||
@@ -301,3 +240,192 @@ (function(TransactionType2) { | ||
})(StreamingSwapProgressStatus || (StreamingSwapProgressStatus = {})); | ||
var ERROR_CODE; | ||
(function(ERROR_CODE2) { | ||
ERROR_CODE2["INVALID_INPUT_PARAMETERS"] = "1000"; | ||
ERROR_CODE2["UNKNOWN_PROVIDERS"] = "1001"; | ||
ERROR_CODE2["CANNOT_FIND_INBOUND_ADDRESS"] = "1002"; | ||
ERROR_CODE2["NO_INBOUND_ADDRESSES"] = "1003"; | ||
ERROR_CODE2["CHAIN_HALTED_OR_UNSUPPORTED"] = "1004"; | ||
ERROR_CODE2["MISSING_INPUT_PARAMETER"] = "1005"; | ||
ERROR_CODE2["INVALID_TYPE_GENERIC"] = "1100"; | ||
ERROR_CODE2["INVALID_NUMBER_STRING"] = "1101"; | ||
ERROR_CODE2["INVALID_NUMBER"] = "1102"; | ||
ERROR_CODE2["INVALID_BOOLEAN"] = "1103"; | ||
ERROR_CODE2["INVALID_OBJECT"] = "1104"; | ||
ERROR_CODE2["INVALID_ARRAY"] = "1105"; | ||
ERROR_CODE2["SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER"] = "2000"; | ||
ERROR_CODE2["SELL_BUY_ASSETS_ARE_THE_SAME"] = "2001"; | ||
ERROR_CODE2["MISSING_SOURCE_ADDRESS_FOR_SYNTH"] = "2002"; | ||
ERROR_CODE2["AFF_ADDRESS_AND_BPS_OR_NEITHER"] = "2003"; | ||
ERROR_CODE2["AFF_ADDRESS_TOO_LONG"] = "2004"; | ||
ERROR_CODE2["AFF_BPS_INTEGER_MAX_500"] = "2005"; | ||
ERROR_CODE2["SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN"] = "2006"; | ||
ERROR_CODE2["DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN"] = "2007"; | ||
ERROR_CODE2["PREFERRED_PROVIDER_NOT_SUPPORTED"] = "2008"; | ||
ERROR_CODE2["DESTINATION_ADDRESS_SMART_CONTRACT"] = "2009"; | ||
ERROR_CODE2["BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER"] = "2010"; | ||
ERROR_CODE2["SOURCE_ADDRESS_SMART_CONTRACT"] = "2011"; | ||
ERROR_CODE2["SWAP_AMOUNT_TOO_LOW"] = "2012"; | ||
ERROR_CODE2["INVALID_PROVIDER"] = "2100"; | ||
ERROR_CODE2["MISSING_CROSS_CHAIN_PROVIDER"] = "2101"; | ||
ERROR_CODE2["MISSING_AVAX_PROVIDER"] = "2102"; | ||
ERROR_CODE2["MISSING_BSC_PROVIDER"] = "2103"; | ||
ERROR_CODE2["MISSING_ETH_PROVIDER"] = "2104"; | ||
ERROR_CODE2["INVALID_PROVIDER_FOR_SWAP_OUT"] = "2105"; | ||
ERROR_CODE2["MISSING_ARB_PROVIDER"] = "2106"; | ||
ERROR_CODE2["INVALID_CHAIN"] = "2200"; | ||
ERROR_CODE2["INVALID_ASSET"] = "2201"; | ||
ERROR_CODE2["INVALID_ASSET_IDENTIFIER"] = "2202"; | ||
ERROR_CODE2["UNSUPPORTED_CHAIN"] = "2204"; | ||
ERROR_CODE2["UNSUPPORTED_ASSET"] = "2203"; | ||
ERROR_CODE2["UNSUPPORTED_ASSET_FOR_SWAPOUT"] = "2205"; | ||
ERROR_CODE2["INVALID_SOURCE_ADDRESS"] = "2300"; | ||
ERROR_CODE2["INVALID_DESTINATION_ADDRESS"] = "2301"; | ||
ERROR_CODE2["THORNODE_QUOTE_GENERIC_ERROR"] = "3000"; | ||
ERROR_CODE2["NOT_ENOUGH_SYNTH_BALANCE"] = "3001"; | ||
ERROR_CODE2["SYNTH_MINTING_CAP_REACHED"] = "3002"; | ||
ERROR_CODE2["INVALID_QUOTE_MODE"] = "4000"; | ||
ERROR_CODE2["NO_QUOTES"] = "4001"; | ||
ERROR_CODE2["SERVICE_UNAVAILABLE_GENERIC"] = "5000"; | ||
ERROR_CODE2["MISSING_GAS_DATA_GENERIC"] = "5100"; | ||
ERROR_CODE2["MISSING_TOKEN_INFO_GENERIC"] = "5200"; | ||
ERROR_CODE2["CANT_FIND_TOKEN_LIST"] = "5201"; | ||
ERROR_CODE2["NO_PRICE"] = "5202"; | ||
ERROR_CODE2["PRICE_IS_STALE"] = "5203"; | ||
ERROR_CODE2["ADDRESS_NOT_WHITELISTED"] = "6000"; | ||
ERROR_CODE2["ADDRESS_ALREADY_CLAIMED"] = "6001"; | ||
ERROR_CODE2["TEMPORARY_ERROR"] = "9999"; | ||
})(ERROR_CODE || (ERROR_CODE = {})); | ||
var ERROR_MODULE; | ||
(function(ERROR_MODULE2) { | ||
ERROR_MODULE2["HEALTH_CONTROLLER"] = "1000"; | ||
ERROR_MODULE2["LIQUIDITY_CONTROLLER"] = "1001"; | ||
ERROR_MODULE2["PROVIDER_CONTROLLER"] = "1002"; | ||
ERROR_MODULE2["QUOTE_CONTROLLER"] = "1003"; | ||
ERROR_MODULE2["SWAP_CONTROLLER"] = "1004"; | ||
ERROR_MODULE2["UTIL_CONTROLLER"] = "1005"; | ||
ERROR_MODULE2["AIRDROP_CONTROLLER"] = "1006"; | ||
ERROR_MODULE2["PROVIDER"] = "2000"; | ||
ERROR_MODULE2["ASSET"] = "2001"; | ||
ERROR_MODULE2["TOKEN_LIST"] = "2002"; | ||
ERROR_MODULE2["QUOTE"] = "2100"; | ||
ERROR_MODULE2["QUOTE_TXN_DETAILS"] = "2101"; | ||
ERROR_MODULE2["THORCHAIN_PROVIDER"] = "3000"; | ||
ERROR_MODULE2["UNISWAPV2_ETH_PROVIDER"] = "3001"; | ||
ERROR_MODULE2["UNISWAPV3_ETH_PROVIDER"] = "3002"; | ||
ERROR_MODULE2["SUSHISWAP_ETH_PROVIDER"] = "3003"; | ||
ERROR_MODULE2["PANCAKESWAP_BSC_PROVIDER"] = "3004"; | ||
ERROR_MODULE2["PANCAKESWAP_ETH_PROVIDER"] = "3005"; | ||
ERROR_MODULE2["ONEINCH_ETH_PROVIDER"] = "3006"; | ||
ERROR_MODULE2["ONEINCH_BSC_PROVIDER"] = "3007"; | ||
ERROR_MODULE2["ONEINCH_AVAX_PROVIDER"] = "3008"; | ||
ERROR_MODULE2["ZEROX_ETH_PROVIDER"] = "3009"; | ||
ERROR_MODULE2["WOOFI_AVAX_PROVIDER"] = "3010"; | ||
ERROR_MODULE2["PANGOLIN_AVAX_PROVIDER"] = "3011"; | ||
ERROR_MODULE2["TRADERJOE_AVAX_PROVIDER"] = "3012"; | ||
ERROR_MODULE2["KYBER_ETH_PROVIDER"] = "3013"; | ||
ERROR_MODULE2["KYBER_AVAX_PROVIDER"] = "3014"; | ||
ERROR_MODULE2["WOOFI_BSC_PROVIDER"] = "3015"; | ||
ERROR_MODULE2["STARGATE_PROVIDER"] = "3016"; | ||
ERROR_MODULE2["PROVIDER_UTIL"] = "4000"; | ||
ERROR_MODULE2["TXN_DETAILS"] = "5000"; | ||
ERROR_MODULE2["AIRDROP_UTIL"] = "6000"; | ||
})(ERROR_MODULE || (ERROR_MODULE = {})); | ||
var ApiV1ErrorSchema = z.object({ | ||
status: z.number(), | ||
type: z.nativeEnum(ERROR_TYPE), | ||
code: z.nativeEnum(ERROR_CODE), | ||
module: z.nativeEnum(ERROR_MODULE), | ||
complete: z.string(), | ||
identifier: z.string(), | ||
message: z.string() | ||
}); | ||
// src/thorswapApi/endpoints.ts | ||
function getCachedPrices({ tokens, ...options }) { | ||
const body = new URLSearchParams; | ||
const filteredTokens = tokens.filter((token, index, sourceArr) => sourceArr.findIndex((t) => t === token) === index); | ||
for (const token of filteredTokens) { | ||
body.append("tokens", JSON.stringify(token)); | ||
} | ||
if (options.metadata) | ||
body.append("metadata", "true"); | ||
if (options.lookup) | ||
body.append("lookup", "true"); | ||
if (options.sparkline) | ||
body.append("sparkline", "true"); | ||
return RequestClient3.post(`${baseUrl3}/tokenlist/cached-price`, { | ||
body: body.toString(), | ||
headers: { "Content-Type": "application/x-www-form-urlencoded" } | ||
}); | ||
} | ||
function getSwapQuote(searchParams) { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/tokens/quote`, { | ||
searchParams | ||
}); | ||
} | ||
function getBorrowQuote(searchParams) { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/lending/borrow`, { | ||
searchParams | ||
}); | ||
} | ||
function getRepayQuote(searchParams) { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/lending/repay`, { | ||
searchParams | ||
}); | ||
} | ||
function getLendingAssets() { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/lending/assets`); | ||
} | ||
function getLoans(searchParams) { | ||
return RequestClient3.get(`${baseUrl3}/aggregator/lending/loans`, { searchParams }); | ||
} | ||
function getGasRates() { | ||
return RequestClient3.get(`${baseUrl3}/resource-worker/gasPrice/getAll`); | ||
} | ||
function getTxnDetails(txHash) { | ||
return RequestClient3.get(`${baseUrl3}/apiusage/v2/txn`, { searchParams: { txHash } }); | ||
} | ||
function getTokenListProviders() { | ||
return RequestClient3.get(`${baseUrl3}/tokenlist/providers`); | ||
} | ||
var baseUrl3 = "https://api.thorswap.finance"; | ||
var RequestClient3 = BaseRequestClient.extend({ | ||
hooks: { | ||
afterResponse: [ | ||
async (_request, _options, response) => { | ||
const body = await response.json(); | ||
try { | ||
const errorBody = ApiV1ErrorSchema.parse(body); | ||
return new Response(JSON.stringify(errorBody), { status: 200 }); | ||
} catch (_error) { | ||
return response; | ||
} | ||
} | ||
] | ||
} | ||
}); | ||
// src/thorswapStatic/endpoints.ts | ||
var exports_endpoints4 = {}; | ||
__export(exports_endpoints4, { | ||
getTokenList: () => { | ||
{ | ||
return getTokenList; | ||
} | ||
}, | ||
getLogoForAsset: () => { | ||
{ | ||
return getLogoForAsset; | ||
} | ||
} | ||
}); | ||
import {RequestClient as RequestClient4} from "@swapkit/helpers"; | ||
function getTokenList(tokenListName) { | ||
return RequestClient4.get(`${baseUrl4}/token-list/${tokenListName}.json`); | ||
} | ||
function getLogoForAsset(assetString) { | ||
return `${baseUrl4}/token-list/images/${assetString.toLowerCase()}.png`; | ||
} | ||
var baseUrl4 = "https://static.thorswap.finance"; | ||
// src/index.ts | ||
@@ -314,5 +442,8 @@ var SwapKitApi = { | ||
SwapKitApi, | ||
StreamingSwapProgressStatus | ||
StreamingSwapProgressStatus, | ||
ERROR_MODULE, | ||
ERROR_CODE, | ||
ApiV1ErrorSchema | ||
}; | ||
//# debugId=D2866E4DD0CDEC4C64756e2164756e21 | ||
//# debugId=814A03E565241BF864756e2164756e21 |
{ | ||
"author": "swapkit-oss", | ||
"dependencies": { | ||
"@swapkit/helpers": "1.0.0-rc.99" | ||
"@swapkit/helpers": "1.0.0-rc.100", | ||
"zod": "3.23.8" | ||
}, | ||
@@ -19,3 +20,4 @@ "devDependencies": { | ||
"peerDependencies": { | ||
"@swapkit/helpers": "1.0.0-rc.99" | ||
"@swapkit/helpers": "1.0.0-rc.100", | ||
"zod": "3.23.8" | ||
}, | ||
@@ -37,3 +39,3 @@ "react-native": "./src/index.ts", | ||
"types": "./src/index.ts", | ||
"version": "1.0.0-rc.65" | ||
"version": "1.0.0-rc.66" | ||
} |
@@ -1,17 +0,18 @@ | ||
import { RequestClient } from "@swapkit/helpers"; | ||
import type { | ||
BorrowParams, | ||
BorrowResponse, | ||
CachedPrice, | ||
CachedPricesParams, | ||
GasPriceInfo, | ||
LendingAssetItem, | ||
LoansParams, | ||
LoansResponse, | ||
QuoteParams, | ||
QuoteResponse, | ||
RepayParams, | ||
RepayResponse, | ||
TokenListProvidersResponse, | ||
TxnResponse, | ||
import { RequestClient as BaseRequestClient } from "@swapkit/helpers"; | ||
import { | ||
ApiV1ErrorSchema, | ||
type BorrowParams, | ||
type BorrowResponse, | ||
type CachedPrice, | ||
type CachedPricesParams, | ||
type GasPriceInfo, | ||
type LendingAssetItem, | ||
type LoansParams, | ||
type LoansResponse, | ||
type QuoteParams, | ||
type QuoteResponse, | ||
type RepayParams, | ||
type RepayResponse, | ||
type TokenListProvidersResponse, | ||
type TxnResponse, | ||
} from "./types.ts"; | ||
@@ -21,2 +22,19 @@ | ||
export const RequestClient = BaseRequestClient.extend({ | ||
hooks: { | ||
afterResponse: [ | ||
async (_request, _options, response) => { | ||
const body = await response.json(); | ||
try { | ||
const errorBody = ApiV1ErrorSchema.parse(body); | ||
return new Response(JSON.stringify(errorBody), { status: 200 }); | ||
} catch (_error) { | ||
return response; | ||
} | ||
}, | ||
], | ||
}, | ||
}); | ||
export function getCachedPrices({ tokens, ...options }: CachedPricesParams) { | ||
@@ -43,3 +61,5 @@ const body = new URLSearchParams(); | ||
export function getSwapQuote(searchParams: QuoteParams) { | ||
return RequestClient.get<QuoteResponse>(`${baseUrl}/aggregator/tokens/quote`, { searchParams }); | ||
return RequestClient.get<QuoteResponse>(`${baseUrl}/aggregator/tokens/quote`, { | ||
searchParams, | ||
}); | ||
} | ||
@@ -54,3 +74,5 @@ | ||
export function getRepayQuote(searchParams: RepayParams) { | ||
return RequestClient.get<RepayResponse>(`${baseUrl}/aggregator/lending/repay`, { searchParams }); | ||
return RequestClient.get<RepayResponse>(`${baseUrl}/aggregator/lending/repay`, { | ||
searchParams, | ||
}); | ||
} | ||
@@ -57,0 +79,0 @@ |
import type { Chain, LedgerErrorCode, QuoteMode } from "@swapkit/helpers"; | ||
import { z } from "zod"; | ||
@@ -52,4 +53,2 @@ export type FeeType = "AFFILIATE" | "LIQUIDITY" | "INBOUND" | "OUTBOUND" | "NETWORK"; | ||
export type QuoteResponse = { quoteId: string; routes: QuoteRoute[] }; | ||
export type LoansParams = { address: string; asset: string }; | ||
@@ -228,23 +227,25 @@ | ||
export type RepayResponse = { | ||
inboundAddress: string; | ||
inboundConfirmationBlocks: number; | ||
inboundConfirmationSeconds: number; | ||
outboundDelayBlocks: number; | ||
outboundDelaySeconds: number; | ||
fees: { asset: string; liquidity: string; totalBps: number }; | ||
expiry: number; | ||
warning?: string; | ||
notes?: string; | ||
dustThreshold: string; | ||
memo: string; | ||
expectedAmountOut: string; | ||
expectedCollateralWithdrawn: string; | ||
expectedDebtRepaid: string; | ||
collateralCurrent: string; | ||
repayAssetAmount: string; | ||
repayAssetAmountUSD: string; | ||
streamingSwap?: RepayStreamingSwap; | ||
estimatedTime?: number; | ||
}; | ||
export type RepayResponse = | ||
| ApiV1Error | ||
| { | ||
inboundAddress: string; | ||
inboundConfirmationBlocks: number; | ||
inboundConfirmationSeconds: number; | ||
outboundDelayBlocks: number; | ||
outboundDelaySeconds: number; | ||
fees: { asset: string; liquidity: string; totalBps: number }; | ||
expiry: number; | ||
warning?: string; | ||
notes?: string; | ||
dustThreshold: string; | ||
memo: string; | ||
expectedAmountOut: string; | ||
expectedCollateralWithdrawn: string; | ||
expectedDebtRepaid: string; | ||
collateralCurrent: string; | ||
repayAssetAmount: string; | ||
repayAssetAmountUSD: string; | ||
streamingSwap?: RepayStreamingSwap; | ||
estimatedTime?: number; | ||
}; | ||
@@ -283,25 +284,29 @@ export type BorrowParams = { | ||
export type BorrowResponse = { | ||
amountIn: string; | ||
amountOut: string; | ||
amountOutMin: string; | ||
calldata: BorrowCalldata; | ||
complete: boolean; | ||
estimatedTime: number; | ||
expectedCollateralDeposited: string; | ||
expectedDebtIssued: string; | ||
expectedOutput: string; | ||
expectedOutputMaxSlippage: string; | ||
expectedOutputMaxSlippageUSD: string; | ||
expectedOutputUSD: string; | ||
fees: QuoteRoute["fees"]; | ||
fromAsset: string; | ||
memo: string; | ||
recipientAddress: string; | ||
route: { meta: { thornodeMeta: { inboundConfirmationSeconds: number; outboundDelay: number } } }; | ||
streamingSwap?: BorrowStreamingSwap; | ||
swaps: QuoteRoute["swaps"]; | ||
targetAddress: string; | ||
toAsset: string; | ||
}; | ||
export type BorrowResponse = | ||
| ApiV1Error | ||
| { | ||
amountIn: string; | ||
amountOut: string; | ||
amountOutMin: string; | ||
calldata: BorrowCalldata; | ||
complete: boolean; | ||
estimatedTime: number; | ||
expectedCollateralDeposited: string; | ||
expectedDebtIssued: string; | ||
expectedOutput: string; | ||
expectedOutputMaxSlippage: string; | ||
expectedOutputMaxSlippageUSD: string; | ||
expectedOutputUSD: string; | ||
fees: QuoteRoute["fees"]; | ||
fromAsset: string; | ||
memo: string; | ||
recipientAddress: string; | ||
route: { | ||
meta: { thornodeMeta: { inboundConfirmationSeconds: number; outboundDelay: number } }; | ||
}; | ||
streamingSwap?: BorrowStreamingSwap; | ||
swaps: QuoteRoute["swaps"]; | ||
targetAddress: string; | ||
toAsset: string; | ||
}; | ||
@@ -509,1 +514,122 @@ export type EVMTransactionDetails = { | ||
}; | ||
export enum ERROR_CODE { | ||
INVALID_INPUT_PARAMETERS = "1000", | ||
UNKNOWN_PROVIDERS = "1001", | ||
CANNOT_FIND_INBOUND_ADDRESS = "1002", | ||
NO_INBOUND_ADDRESSES = "1003", | ||
CHAIN_HALTED_OR_UNSUPPORTED = "1004", | ||
MISSING_INPUT_PARAMETER = "1005", | ||
INVALID_TYPE_GENERIC = "1100", | ||
INVALID_NUMBER_STRING = "1101", | ||
INVALID_NUMBER = "1102", | ||
INVALID_BOOLEAN = "1103", | ||
INVALID_OBJECT = "1104", | ||
INVALID_ARRAY = "1105", | ||
SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", | ||
SELL_BUY_ASSETS_ARE_THE_SAME = "2001", | ||
MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", | ||
AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", | ||
AFF_ADDRESS_TOO_LONG = "2004", | ||
AFF_BPS_INTEGER_MAX_500 = "2005", | ||
SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", | ||
DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", | ||
PREFERRED_PROVIDER_NOT_SUPPORTED = "2008", | ||
DESTINATION_ADDRESS_SMART_CONTRACT = "2009", | ||
BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", | ||
SOURCE_ADDRESS_SMART_CONTRACT = "2011", | ||
SWAP_AMOUNT_TOO_LOW = "2012", | ||
INVALID_PROVIDER = "2100", | ||
MISSING_CROSS_CHAIN_PROVIDER = "2101", | ||
MISSING_AVAX_PROVIDER = "2102", | ||
MISSING_BSC_PROVIDER = "2103", | ||
MISSING_ETH_PROVIDER = "2104", | ||
INVALID_PROVIDER_FOR_SWAP_OUT = "2105", | ||
MISSING_ARB_PROVIDER = "2106", | ||
INVALID_CHAIN = "2200", | ||
INVALID_ASSET = "2201", | ||
INVALID_ASSET_IDENTIFIER = "2202", | ||
UNSUPPORTED_CHAIN = "2204", | ||
UNSUPPORTED_ASSET = "2203", | ||
UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", | ||
INVALID_SOURCE_ADDRESS = "2300", | ||
INVALID_DESTINATION_ADDRESS = "2301", | ||
THORNODE_QUOTE_GENERIC_ERROR = "3000", | ||
NOT_ENOUGH_SYNTH_BALANCE = "3001", | ||
SYNTH_MINTING_CAP_REACHED = "3002", | ||
INVALID_QUOTE_MODE = "4000", | ||
NO_QUOTES = "4001", | ||
SERVICE_UNAVAILABLE_GENERIC = "5000", | ||
MISSING_GAS_DATA_GENERIC = "5100", | ||
MISSING_TOKEN_INFO_GENERIC = "5200", | ||
CANT_FIND_TOKEN_LIST = "5201", | ||
NO_PRICE = "5202", | ||
PRICE_IS_STALE = "5203", | ||
ADDRESS_NOT_WHITELISTED = "6000", | ||
ADDRESS_ALREADY_CLAIMED = "6001", | ||
TEMPORARY_ERROR = "9999", | ||
} | ||
export enum ERROR_MODULE { | ||
HEALTH_CONTROLLER = "1000", | ||
LIQUIDITY_CONTROLLER = "1001", | ||
PROVIDER_CONTROLLER = "1002", | ||
QUOTE_CONTROLLER = "1003", | ||
SWAP_CONTROLLER = "1004", | ||
UTIL_CONTROLLER = "1005", | ||
AIRDROP_CONTROLLER = "1006", | ||
PROVIDER = "2000", | ||
ASSET = "2001", | ||
TOKEN_LIST = "2002", | ||
QUOTE = "2100", | ||
QUOTE_TXN_DETAILS = "2101", | ||
THORCHAIN_PROVIDER = "3000", | ||
UNISWAPV2_ETH_PROVIDER = "3001", | ||
UNISWAPV3_ETH_PROVIDER = "3002", | ||
SUSHISWAP_ETH_PROVIDER = "3003", | ||
PANCAKESWAP_BSC_PROVIDER = "3004", | ||
PANCAKESWAP_ETH_PROVIDER = "3005", | ||
ONEINCH_ETH_PROVIDER = "3006", | ||
ONEINCH_BSC_PROVIDER = "3007", | ||
ONEINCH_AVAX_PROVIDER = "3008", | ||
ZEROX_ETH_PROVIDER = "3009", | ||
WOOFI_AVAX_PROVIDER = "3010", | ||
PANGOLIN_AVAX_PROVIDER = "3011", | ||
TRADERJOE_AVAX_PROVIDER = "3012", | ||
KYBER_ETH_PROVIDER = "3013", | ||
KYBER_AVAX_PROVIDER = "3014", | ||
WOOFI_BSC_PROVIDER = "3015", | ||
STARGATE_PROVIDER = "3016", | ||
PROVIDER_UTIL = "4000", | ||
TXN_DETAILS = "5000", | ||
AIRDROP_UTIL = "6000", | ||
} | ||
export declare enum ERROR_TYPE { | ||
VALIDATION_ERROR = "VALIDATION_ERROR", | ||
REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", | ||
RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", | ||
UNSUPPORTED = "UNSUPPORTED", | ||
NOT_IMPLEMENTED = "NOT_IMPLEMENTED", | ||
INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", | ||
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", | ||
DOWN_FOR_MAINTENANCE = "DOWN_FOR_MAINTENANCE", | ||
MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", | ||
QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", | ||
AIRDROP_ERROR = "AIRDROP_ERROR", | ||
UNHANDLED_ERROR = "UNHANDLED_ERROR", | ||
} | ||
export const ApiV1ErrorSchema = z.object({ | ||
status: z.number(), | ||
type: z.nativeEnum(ERROR_TYPE), | ||
code: z.nativeEnum(ERROR_CODE), | ||
module: z.nativeEnum(ERROR_MODULE), | ||
complete: z.string(), | ||
identifier: z.string(), | ||
message: z.string(), | ||
}); | ||
export type ApiV1Error = z.infer<typeof ApiV1ErrorSchema>; | ||
export type QuoteResponse = { quoteId: string; routes: QuoteRoute[] } | ApiV1Error; |
Sorry, the diff of this file is not supported yet
77586
13
1454
4
+ Addedzod@3.23.8
+ Added@swapkit/helpers@1.0.0-rc.100(transitive)
+ Addedzod@3.23.8(transitive)
- Removed@swapkit/helpers@1.0.0-rc.99(transitive)