@covalenthq/client-sdk
Advanced tools
Comparing version 0.7.5 to 0.7.6
@@ -487,4 +487,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -491,0 +492,0 @@ * |
@@ -367,4 +367,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -371,0 +372,0 @@ * |
@@ -10,7 +10,7 @@ import { SecurityService } from "./SecurityService"; | ||
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP"; | ||
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.5"; | ||
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.6"; | ||
export declare class Response<T> { | ||
data: T; | ||
error: boolean; | ||
error_code: number; | ||
error_code: number | string; | ||
error_message: string; | ||
@@ -23,2 +23,4 @@ } | ||
threadCount?: number; | ||
/** Toggle to turn on and off retry logic */ | ||
enableRetry?: boolean; | ||
} | ||
@@ -25,0 +27,0 @@ /** |
@@ -487,4 +487,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -491,0 +492,0 @@ * |
@@ -73,4 +73,5 @@ import { Chain, Quote } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -77,0 +78,0 @@ * |
@@ -140,4 +140,5 @@ import { Chain, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -144,0 +145,0 @@ * |
@@ -342,2 +342,3 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -358,3 +359,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<RecentTransactionsResponse>>; | ||
@@ -417,2 +418,3 @@ next(): Promise<Response<RecentTransactionsResponse>>; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -433,3 +435,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<TransactionsResponse>>; | ||
@@ -443,2 +445,3 @@ next(): Promise<Response<TransactionsResponse>>; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -460,3 +463,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<TransactionsTimeBucketResponse>>; | ||
@@ -520,4 +523,5 @@ next(): Promise<Response<TransactionsTimeBucketResponse>>; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -524,0 +528,0 @@ * |
@@ -259,2 +259,4 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
fee_24h_quote: number; | ||
/** * The annual fee percentage. */ | ||
annualized_fee: number; | ||
/** * A prettier version of the volume 24h quote for rendering purposes. */ | ||
@@ -320,2 +322,4 @@ pretty_volume_24h_quote: string; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -337,2 +341,4 @@ quote_rate: number; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -450,2 +456,26 @@ quote_rate: number; | ||
pretty_total_quote: string; | ||
/** * The value attached to this tx. */ | ||
value: bigint | null; | ||
/** * The value attached in `quote-currency` to this tx. */ | ||
value_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_value_quote: string; | ||
/** * The requested chain native gas token metadata. */ | ||
gas_metadata: ContractMetadata; | ||
/** * The amount of gas supplied for this tx. */ | ||
gas_offered: string; | ||
/** * The gas spent for this tx. */ | ||
gas_spent: string; | ||
/** * The gas price at the time of this tx. */ | ||
gas_price: string; | ||
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */ | ||
fees_paid: bigint | null; | ||
/** * The gas spent in `quote-currency` denomination. */ | ||
gas_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_gas_quote: string; | ||
/** * The native gas exchange rate for the requested `quote-currency`. */ | ||
gas_quote_rate: number; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
token_0: PoolToken; | ||
@@ -457,2 +487,17 @@ token_1: PoolToken; | ||
} | ||
declare class ContractMetadata { | ||
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
contract_decimals: number; | ||
/** * The string returned by the `name()` method. */ | ||
contract_name: string; | ||
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */ | ||
contract_ticker_symbol: string; | ||
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */ | ||
contract_address: string; | ||
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ | ||
supports_erc: string; | ||
/** * The contract logo URL. */ | ||
logo_url: string; | ||
constructor(data: ContractMetadata); | ||
} | ||
declare class PoolToken { | ||
@@ -520,9 +565,13 @@ /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
gas_token_price_quote: number; | ||
total_swaps24h: number; | ||
total_active_pairs7d: number; | ||
total_fees24h: number; | ||
volume_chart7d: VolumeEcosystemChart[]; | ||
volume_chart30d: VolumeEcosystemChart[]; | ||
liquidity_chart7d: LiquidityEcosystemChart[]; | ||
liquidity_chart30d: LiquidityEcosystemChart[]; | ||
total_swaps_24h: number; | ||
total_active_pairs_7d: number; | ||
total_fees_24h: number; | ||
/** * A prettier version of the gas quote for rendering purposes. */ | ||
pretty_gas_token_price_quote: string; | ||
/** * A prettier version of the 24h total fees for rendering purposes. */ | ||
pretty_total_fees_24h: string; | ||
volume_chart_7d: VolumeEcosystemChart[]; | ||
volume_chart_30d: VolumeEcosystemChart[]; | ||
liquidity_chart_7d: LiquidityEcosystemChart[]; | ||
liquidity_chart_30d: LiquidityEcosystemChart[]; | ||
constructor(data: UniswapLikeEcosystemCharts); | ||
@@ -539,2 +588,4 @@ } | ||
volume_quote: number; | ||
/** * A prettier version of the volume quote for rendering purposes. */ | ||
pretty_volume_quote: string; | ||
swap_count_24: number; | ||
@@ -552,2 +603,4 @@ constructor(data: VolumeEcosystemChart); | ||
liquidity_quote: number; | ||
/** * A prettier version of the liquidity quote for rendering purposes. */ | ||
pretty_liquidity_quote: string; | ||
constructor(data: LiquidityEcosystemChart); | ||
@@ -598,4 +651,5 @@ } | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -602,0 +656,0 @@ * |
export declare function checkAndModifyResponse(jsonObj: any): void; | ||
export declare function debugOutput(url: string, responseStatus: number, startTime: number | [number, number] | undefined): Promise<void>; | ||
type Constructor<T> = new (...args: any[]) => T; | ||
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number): AsyncIterable<T1>; | ||
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number, enableRetry: boolean): AsyncIterable<T1>; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { Pagination } from "./GenericTypes"; | ||
import { Pagination, ContractMetadata } from "./GenericTypes"; | ||
export interface PoolResponse { | ||
@@ -235,2 +235,4 @@ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
fee_24h_quote: number; | ||
/** * The annual fee percentage. */ | ||
annualized_fee: number; | ||
/** * A prettier version of the volume 24h quote for rendering purposes. */ | ||
@@ -292,2 +294,4 @@ pretty_volume_24h_quote: string; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -308,2 +312,4 @@ quote_rate: number; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -415,2 +421,26 @@ quote_rate: number; | ||
pretty_total_quote: string; | ||
/** * The value attached to this tx. */ | ||
value: bigint | null; | ||
/** * The value attached in `quote-currency` to this tx. */ | ||
value_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_value_quote: string; | ||
/** * The requested chain native gas token metadata. */ | ||
gas_metadata: ContractMetadata; | ||
/** * The amount of gas supplied for this tx. */ | ||
gas_offered: string; | ||
/** * The gas spent for this tx. */ | ||
gas_spent: string; | ||
/** * The gas price at the time of this tx. */ | ||
gas_price: string; | ||
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */ | ||
fees_paid: bigint | null; | ||
/** * The gas spent in `quote-currency` denomination. */ | ||
gas_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_gas_quote: string; | ||
/** * The native gas exchange rate for the requested `quote-currency`. */ | ||
gas_quote_rate: number; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
token_0: PoolToken; | ||
@@ -479,9 +509,13 @@ token_1: PoolToken; | ||
gas_token_price_quote: number; | ||
total_swaps24h: number; | ||
total_active_pairs7d: number; | ||
total_fees24h: number; | ||
volume_chart7d: VolumeEcosystemChart[]; | ||
volume_chart30d: VolumeEcosystemChart[]; | ||
liquidity_chart7d: LiquidityEcosystemChart[]; | ||
liquidity_chart30d: LiquidityEcosystemChart[]; | ||
total_swaps_24h: number; | ||
total_active_pairs_7d: number; | ||
total_fees_24h: number; | ||
/** * A prettier version of the gas quote for rendering purposes. */ | ||
pretty_gas_token_price_quote: string; | ||
/** * A prettier version of the 24h total fees for rendering purposes. */ | ||
pretty_total_fees_24h: string; | ||
volume_chart_7d: VolumeEcosystemChart[]; | ||
volume_chart_30d: VolumeEcosystemChart[]; | ||
liquidity_chart_7d: LiquidityEcosystemChart[]; | ||
liquidity_chart_30d: LiquidityEcosystemChart[]; | ||
} | ||
@@ -497,2 +531,4 @@ export interface VolumeEcosystemChart { | ||
volume_quote: number; | ||
/** * A prettier version of the volume quote for rendering purposes. */ | ||
pretty_volume_quote: string; | ||
swap_count_24: number; | ||
@@ -509,2 +545,4 @@ } | ||
liquidity_quote: number; | ||
/** * A prettier version of the liquidity quote for rendering purposes. */ | ||
pretty_liquidity_quote: string; | ||
} | ||
@@ -511,0 +549,0 @@ export interface HealthDataResponse { |
@@ -487,4 +487,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -491,0 +492,0 @@ * |
@@ -367,4 +367,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -371,0 +372,0 @@ * |
@@ -10,7 +10,7 @@ import { SecurityService } from "./SecurityService"; | ||
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP"; | ||
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.5"; | ||
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.6"; | ||
export declare class Response<T> { | ||
data: T; | ||
error: boolean; | ||
error_code: number; | ||
error_code: number | string; | ||
error_message: string; | ||
@@ -23,2 +23,4 @@ } | ||
threadCount?: number; | ||
/** Toggle to turn on and off retry logic */ | ||
enableRetry?: boolean; | ||
} | ||
@@ -25,0 +27,0 @@ /** |
@@ -487,4 +487,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -491,0 +492,0 @@ * |
@@ -73,4 +73,5 @@ import { Chain, Quote } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -77,0 +78,0 @@ * |
@@ -140,4 +140,5 @@ import { Chain, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -144,0 +145,0 @@ * |
@@ -342,2 +342,3 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -358,3 +359,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<RecentTransactionsResponse>>; | ||
@@ -417,2 +418,3 @@ next(): Promise<Response<RecentTransactionsResponse>>; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -433,3 +435,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<TransactionsResponse>>; | ||
@@ -443,2 +445,3 @@ next(): Promise<Response<TransactionsResponse>>; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -460,3 +463,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<TransactionsTimeBucketResponse>>; | ||
@@ -520,4 +523,5 @@ next(): Promise<Response<TransactionsTimeBucketResponse>>; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -524,0 +528,0 @@ * |
@@ -259,2 +259,4 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
fee_24h_quote: number; | ||
/** * The annual fee percentage. */ | ||
annualized_fee: number; | ||
/** * A prettier version of the volume 24h quote for rendering purposes. */ | ||
@@ -320,2 +322,4 @@ pretty_volume_24h_quote: string; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -337,2 +341,4 @@ quote_rate: number; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -450,2 +456,26 @@ quote_rate: number; | ||
pretty_total_quote: string; | ||
/** * The value attached to this tx. */ | ||
value: bigint | null; | ||
/** * The value attached in `quote-currency` to this tx. */ | ||
value_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_value_quote: string; | ||
/** * The requested chain native gas token metadata. */ | ||
gas_metadata: ContractMetadata; | ||
/** * The amount of gas supplied for this tx. */ | ||
gas_offered: string; | ||
/** * The gas spent for this tx. */ | ||
gas_spent: string; | ||
/** * The gas price at the time of this tx. */ | ||
gas_price: string; | ||
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */ | ||
fees_paid: bigint | null; | ||
/** * The gas spent in `quote-currency` denomination. */ | ||
gas_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_gas_quote: string; | ||
/** * The native gas exchange rate for the requested `quote-currency`. */ | ||
gas_quote_rate: number; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
token_0: PoolToken; | ||
@@ -457,2 +487,17 @@ token_1: PoolToken; | ||
} | ||
declare class ContractMetadata { | ||
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
contract_decimals: number; | ||
/** * The string returned by the `name()` method. */ | ||
contract_name: string; | ||
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */ | ||
contract_ticker_symbol: string; | ||
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */ | ||
contract_address: string; | ||
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ | ||
supports_erc: string; | ||
/** * The contract logo URL. */ | ||
logo_url: string; | ||
constructor(data: ContractMetadata); | ||
} | ||
declare class PoolToken { | ||
@@ -520,9 +565,13 @@ /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
gas_token_price_quote: number; | ||
total_swaps24h: number; | ||
total_active_pairs7d: number; | ||
total_fees24h: number; | ||
volume_chart7d: VolumeEcosystemChart[]; | ||
volume_chart30d: VolumeEcosystemChart[]; | ||
liquidity_chart7d: LiquidityEcosystemChart[]; | ||
liquidity_chart30d: LiquidityEcosystemChart[]; | ||
total_swaps_24h: number; | ||
total_active_pairs_7d: number; | ||
total_fees_24h: number; | ||
/** * A prettier version of the gas quote for rendering purposes. */ | ||
pretty_gas_token_price_quote: string; | ||
/** * A prettier version of the 24h total fees for rendering purposes. */ | ||
pretty_total_fees_24h: string; | ||
volume_chart_7d: VolumeEcosystemChart[]; | ||
volume_chart_30d: VolumeEcosystemChart[]; | ||
liquidity_chart_7d: LiquidityEcosystemChart[]; | ||
liquidity_chart_30d: LiquidityEcosystemChart[]; | ||
constructor(data: UniswapLikeEcosystemCharts); | ||
@@ -539,2 +588,4 @@ } | ||
volume_quote: number; | ||
/** * A prettier version of the volume quote for rendering purposes. */ | ||
pretty_volume_quote: string; | ||
swap_count_24: number; | ||
@@ -552,2 +603,4 @@ constructor(data: VolumeEcosystemChart); | ||
liquidity_quote: number; | ||
/** * A prettier version of the liquidity quote for rendering purposes. */ | ||
pretty_liquidity_quote: string; | ||
constructor(data: LiquidityEcosystemChart); | ||
@@ -598,4 +651,5 @@ } | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -602,0 +656,0 @@ * |
export declare function checkAndModifyResponse(jsonObj: any): void; | ||
export declare function debugOutput(url: string, responseStatus: number, startTime: number | [number, number] | undefined): Promise<void>; | ||
type Constructor<T> = new (...args: any[]) => T; | ||
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number): AsyncIterable<T1>; | ||
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number, enableRetry: boolean): AsyncIterable<T1>; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { Pagination } from "./GenericTypes"; | ||
import { Pagination, ContractMetadata } from "./GenericTypes"; | ||
export interface PoolResponse { | ||
@@ -235,2 +235,4 @@ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
fee_24h_quote: number; | ||
/** * The annual fee percentage. */ | ||
annualized_fee: number; | ||
/** * A prettier version of the volume 24h quote for rendering purposes. */ | ||
@@ -292,2 +294,4 @@ pretty_volume_24h_quote: string; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -308,2 +312,4 @@ quote_rate: number; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -415,2 +421,26 @@ quote_rate: number; | ||
pretty_total_quote: string; | ||
/** * The value attached to this tx. */ | ||
value: bigint | null; | ||
/** * The value attached in `quote-currency` to this tx. */ | ||
value_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_value_quote: string; | ||
/** * The requested chain native gas token metadata. */ | ||
gas_metadata: ContractMetadata; | ||
/** * The amount of gas supplied for this tx. */ | ||
gas_offered: string; | ||
/** * The gas spent for this tx. */ | ||
gas_spent: string; | ||
/** * The gas price at the time of this tx. */ | ||
gas_price: string; | ||
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */ | ||
fees_paid: bigint | null; | ||
/** * The gas spent in `quote-currency` denomination. */ | ||
gas_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_gas_quote: string; | ||
/** * The native gas exchange rate for the requested `quote-currency`. */ | ||
gas_quote_rate: number; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
token_0: PoolToken; | ||
@@ -479,9 +509,13 @@ token_1: PoolToken; | ||
gas_token_price_quote: number; | ||
total_swaps24h: number; | ||
total_active_pairs7d: number; | ||
total_fees24h: number; | ||
volume_chart7d: VolumeEcosystemChart[]; | ||
volume_chart30d: VolumeEcosystemChart[]; | ||
liquidity_chart7d: LiquidityEcosystemChart[]; | ||
liquidity_chart30d: LiquidityEcosystemChart[]; | ||
total_swaps_24h: number; | ||
total_active_pairs_7d: number; | ||
total_fees_24h: number; | ||
/** * A prettier version of the gas quote for rendering purposes. */ | ||
pretty_gas_token_price_quote: string; | ||
/** * A prettier version of the 24h total fees for rendering purposes. */ | ||
pretty_total_fees_24h: string; | ||
volume_chart_7d: VolumeEcosystemChart[]; | ||
volume_chart_30d: VolumeEcosystemChart[]; | ||
liquidity_chart_7d: LiquidityEcosystemChart[]; | ||
liquidity_chart_30d: LiquidityEcosystemChart[]; | ||
} | ||
@@ -497,2 +531,4 @@ export interface VolumeEcosystemChart { | ||
volume_quote: number; | ||
/** * A prettier version of the volume quote for rendering purposes. */ | ||
pretty_volume_quote: string; | ||
swap_count_24: number; | ||
@@ -509,2 +545,4 @@ } | ||
liquidity_quote: number; | ||
/** * A prettier version of the liquidity quote for rendering purposes. */ | ||
pretty_liquidity_quote: string; | ||
} | ||
@@ -511,0 +549,0 @@ export interface HealthDataResponse { |
@@ -487,4 +487,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -491,0 +492,0 @@ * |
@@ -367,4 +367,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -371,0 +372,0 @@ * |
@@ -10,7 +10,7 @@ import { SecurityService } from "./SecurityService"; | ||
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP"; | ||
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.5"; | ||
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.6"; | ||
export declare class Response<T> { | ||
data: T; | ||
error: boolean; | ||
error_code: number; | ||
error_code: number | string; | ||
error_message: string; | ||
@@ -23,2 +23,4 @@ } | ||
threadCount?: number; | ||
/** Toggle to turn on and off retry logic */ | ||
enableRetry?: boolean; | ||
} | ||
@@ -25,0 +27,0 @@ /** |
@@ -487,4 +487,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -491,0 +492,0 @@ * |
@@ -73,4 +73,5 @@ import { Chain, Quote } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -77,0 +78,0 @@ * |
@@ -140,4 +140,5 @@ import { Chain, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -144,0 +145,0 @@ * |
@@ -342,2 +342,3 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -358,3 +359,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<RecentTransactionsResponse>>; | ||
@@ -417,2 +418,3 @@ next(): Promise<Response<RecentTransactionsResponse>>; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -433,3 +435,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<TransactionsResponse>>; | ||
@@ -443,2 +445,3 @@ next(): Promise<Response<TransactionsResponse>>; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -460,3 +463,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<TransactionsTimeBucketResponse>>; | ||
@@ -520,4 +523,5 @@ next(): Promise<Response<TransactionsTimeBucketResponse>>; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -524,0 +528,0 @@ * |
@@ -259,2 +259,4 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
fee_24h_quote: number; | ||
/** * The annual fee percentage. */ | ||
annualized_fee: number; | ||
/** * A prettier version of the volume 24h quote for rendering purposes. */ | ||
@@ -320,2 +322,4 @@ pretty_volume_24h_quote: string; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -337,2 +341,4 @@ quote_rate: number; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -450,2 +456,26 @@ quote_rate: number; | ||
pretty_total_quote: string; | ||
/** * The value attached to this tx. */ | ||
value: bigint | null; | ||
/** * The value attached in `quote-currency` to this tx. */ | ||
value_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_value_quote: string; | ||
/** * The requested chain native gas token metadata. */ | ||
gas_metadata: ContractMetadata; | ||
/** * The amount of gas supplied for this tx. */ | ||
gas_offered: string; | ||
/** * The gas spent for this tx. */ | ||
gas_spent: string; | ||
/** * The gas price at the time of this tx. */ | ||
gas_price: string; | ||
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */ | ||
fees_paid: bigint | null; | ||
/** * The gas spent in `quote-currency` denomination. */ | ||
gas_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_gas_quote: string; | ||
/** * The native gas exchange rate for the requested `quote-currency`. */ | ||
gas_quote_rate: number; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
token_0: PoolToken; | ||
@@ -457,2 +487,17 @@ token_1: PoolToken; | ||
} | ||
declare class ContractMetadata { | ||
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
contract_decimals: number; | ||
/** * The string returned by the `name()` method. */ | ||
contract_name: string; | ||
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */ | ||
contract_ticker_symbol: string; | ||
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */ | ||
contract_address: string; | ||
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ | ||
supports_erc: string; | ||
/** * The contract logo URL. */ | ||
logo_url: string; | ||
constructor(data: ContractMetadata); | ||
} | ||
declare class PoolToken { | ||
@@ -520,9 +565,13 @@ /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
gas_token_price_quote: number; | ||
total_swaps24h: number; | ||
total_active_pairs7d: number; | ||
total_fees24h: number; | ||
volume_chart7d: VolumeEcosystemChart[]; | ||
volume_chart30d: VolumeEcosystemChart[]; | ||
liquidity_chart7d: LiquidityEcosystemChart[]; | ||
liquidity_chart30d: LiquidityEcosystemChart[]; | ||
total_swaps_24h: number; | ||
total_active_pairs_7d: number; | ||
total_fees_24h: number; | ||
/** * A prettier version of the gas quote for rendering purposes. */ | ||
pretty_gas_token_price_quote: string; | ||
/** * A prettier version of the 24h total fees for rendering purposes. */ | ||
pretty_total_fees_24h: string; | ||
volume_chart_7d: VolumeEcosystemChart[]; | ||
volume_chart_30d: VolumeEcosystemChart[]; | ||
liquidity_chart_7d: LiquidityEcosystemChart[]; | ||
liquidity_chart_30d: LiquidityEcosystemChart[]; | ||
constructor(data: UniswapLikeEcosystemCharts); | ||
@@ -539,2 +588,4 @@ } | ||
volume_quote: number; | ||
/** * A prettier version of the volume quote for rendering purposes. */ | ||
pretty_volume_quote: string; | ||
swap_count_24: number; | ||
@@ -552,2 +603,4 @@ constructor(data: VolumeEcosystemChart); | ||
liquidity_quote: number; | ||
/** * A prettier version of the liquidity quote for rendering purposes. */ | ||
pretty_liquidity_quote: string; | ||
constructor(data: LiquidityEcosystemChart); | ||
@@ -598,4 +651,5 @@ } | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -602,0 +656,0 @@ * |
export declare function checkAndModifyResponse(jsonObj: any): void; | ||
export declare function debugOutput(url: string, responseStatus: number, startTime: number | [number, number] | undefined): Promise<void>; | ||
type Constructor<T> = new (...args: any[]) => T; | ||
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number): AsyncIterable<T1>; | ||
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number, enableRetry: boolean): AsyncIterable<T1>; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { Pagination } from "./GenericTypes"; | ||
import { Pagination, ContractMetadata } from "./GenericTypes"; | ||
export interface PoolResponse { | ||
@@ -235,2 +235,4 @@ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
fee_24h_quote: number; | ||
/** * The annual fee percentage. */ | ||
annualized_fee: number; | ||
/** * A prettier version of the volume 24h quote for rendering purposes. */ | ||
@@ -292,2 +294,4 @@ pretty_volume_24h_quote: string; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -308,2 +312,4 @@ quote_rate: number; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -415,2 +421,26 @@ quote_rate: number; | ||
pretty_total_quote: string; | ||
/** * The value attached to this tx. */ | ||
value: bigint | null; | ||
/** * The value attached in `quote-currency` to this tx. */ | ||
value_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_value_quote: string; | ||
/** * The requested chain native gas token metadata. */ | ||
gas_metadata: ContractMetadata; | ||
/** * The amount of gas supplied for this tx. */ | ||
gas_offered: string; | ||
/** * The gas spent for this tx. */ | ||
gas_spent: string; | ||
/** * The gas price at the time of this tx. */ | ||
gas_price: string; | ||
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */ | ||
fees_paid: bigint | null; | ||
/** * The gas spent in `quote-currency` denomination. */ | ||
gas_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_gas_quote: string; | ||
/** * The native gas exchange rate for the requested `quote-currency`. */ | ||
gas_quote_rate: number; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
token_0: PoolToken; | ||
@@ -479,9 +509,13 @@ token_1: PoolToken; | ||
gas_token_price_quote: number; | ||
total_swaps24h: number; | ||
total_active_pairs7d: number; | ||
total_fees24h: number; | ||
volume_chart7d: VolumeEcosystemChart[]; | ||
volume_chart30d: VolumeEcosystemChart[]; | ||
liquidity_chart7d: LiquidityEcosystemChart[]; | ||
liquidity_chart30d: LiquidityEcosystemChart[]; | ||
total_swaps_24h: number; | ||
total_active_pairs_7d: number; | ||
total_fees_24h: number; | ||
/** * A prettier version of the gas quote for rendering purposes. */ | ||
pretty_gas_token_price_quote: string; | ||
/** * A prettier version of the 24h total fees for rendering purposes. */ | ||
pretty_total_fees_24h: string; | ||
volume_chart_7d: VolumeEcosystemChart[]; | ||
volume_chart_30d: VolumeEcosystemChart[]; | ||
liquidity_chart_7d: LiquidityEcosystemChart[]; | ||
liquidity_chart_30d: LiquidityEcosystemChart[]; | ||
} | ||
@@ -497,2 +531,4 @@ export interface VolumeEcosystemChart { | ||
volume_quote: number; | ||
/** * A prettier version of the volume quote for rendering purposes. */ | ||
pretty_volume_quote: string; | ||
swap_count_24: number; | ||
@@ -509,2 +545,4 @@ } | ||
liquidity_quote: number; | ||
/** * A prettier version of the liquidity quote for rendering purposes. */ | ||
pretty_liquidity_quote: string; | ||
} | ||
@@ -511,0 +549,0 @@ export interface HealthDataResponse { |
@@ -487,4 +487,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -491,0 +492,0 @@ * |
@@ -288,3 +288,3 @@ import { userAgent } from "./CovalentClient"; | ||
export class BalanceService { | ||
constructor(apiKey, debug = false, threadCount = 3, is_key_valid) { | ||
constructor(apiKey, debug = false, threadCount = 3, is_key_valid, enableRetry = true) { | ||
this.apiKey = apiKey; | ||
@@ -294,2 +294,3 @@ this.debug = debug; | ||
this.is_key_valid = is_key_valid; | ||
this.enableRetry = enableRetry; | ||
this.LIMIT = pLimit(this.threadCount); | ||
@@ -342,2 +343,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_v2/?${urlParams}`; | ||
let startTime; | ||
@@ -353,6 +355,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -387,4 +389,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -427,2 +429,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/portfolio_v2/?${urlParams}`; | ||
let startTime; | ||
@@ -438,6 +441,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -472,4 +475,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -521,3 +524,3 @@ } | ||
} | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transfers_v2/`, this.apiKey, urlParams, BlockTransactionWithContractTransfers, this.debug, this.threadCount)) { | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transfers_v2/`, this.apiKey, urlParams, BlockTransactionWithContractTransfers, this.debug, this.threadCount, this.enableRetry)) { | ||
yield res; | ||
@@ -582,2 +585,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transfers_v2/?${urlParams}`; | ||
let startTime; | ||
@@ -593,6 +597,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -627,4 +631,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -668,3 +672,3 @@ } | ||
} | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/tokens/${tokenAddress}/token_holders_v2/`, this.apiKey, urlParams, TokenHolder, this.debug, this.threadCount)) { | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/tokens/${tokenAddress}/token_holders_v2/`, this.apiKey, urlParams, TokenHolder, this.debug, this.threadCount, this.enableRetry)) { | ||
yield res; | ||
@@ -721,2 +725,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/tokens/${tokenAddress}/token_holders_v2/?${urlParams}`; | ||
let startTime; | ||
@@ -732,6 +737,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -766,4 +771,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -826,2 +831,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/historical_balances/?${urlParams}`; | ||
let startTime; | ||
@@ -837,6 +843,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -871,4 +877,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -909,2 +915,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_native/?${urlParams}`; | ||
let startTime; | ||
@@ -920,6 +927,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -954,4 +961,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -958,0 +965,0 @@ } |
@@ -367,4 +367,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -371,0 +372,0 @@ * |
@@ -228,3 +228,3 @@ import { userAgent } from "./CovalentClient"; | ||
export class BaseService { | ||
constructor(apiKey, debug = false, threadCount = 3, is_key_valid) { | ||
constructor(apiKey, debug = false, threadCount = 3, is_key_valid, enableRetry = true) { | ||
this.apiKey = apiKey; | ||
@@ -234,2 +234,3 @@ this.debug = debug; | ||
this.is_key_valid = is_key_valid; | ||
this.enableRetry = enableRetry; | ||
this.LIMIT = pLimit(this.threadCount); | ||
@@ -261,2 +262,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/block_v2/${blockHeight}/?${urlParams}`; | ||
let startTime; | ||
@@ -272,6 +274,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -306,4 +308,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -337,2 +339,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/resolve_address/?${urlParams}`; | ||
let startTime; | ||
@@ -348,6 +351,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -382,4 +385,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -416,3 +419,3 @@ } | ||
} | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/block_v2/${startDate}/${endDate}/`, this.apiKey, urlParams, Block, this.debug, this.threadCount)) { | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/block_v2/${startDate}/${endDate}/`, this.apiKey, urlParams, Block, this.debug, this.threadCount, this.enableRetry)) { | ||
yield res; | ||
@@ -462,2 +465,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/block_v2/${startDate}/${endDate}/?${urlParams}`; | ||
let startTime; | ||
@@ -473,6 +477,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -507,4 +511,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -562,2 +566,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/events/?${urlParams}`; | ||
let startTime; | ||
@@ -573,6 +578,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -607,4 +612,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -648,3 +653,3 @@ } | ||
} | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/events/address/${contractAddress}/`, this.apiKey, urlParams, LogEvent, this.debug, this.threadCount)) { | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/events/address/${contractAddress}/`, this.apiKey, urlParams, LogEvent, this.debug, this.threadCount, this.enableRetry)) { | ||
yield res; | ||
@@ -701,2 +706,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/events/address/${contractAddress}/?${urlParams}`; | ||
let startTime; | ||
@@ -712,6 +718,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -746,4 +752,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -791,3 +797,3 @@ } | ||
} | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/events/topics/${topicHash}/`, this.apiKey, urlParams, LogEvent, this.debug, this.threadCount)) { | ||
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/events/topics/${topicHash}/`, this.apiKey, urlParams, LogEvent, this.debug, this.threadCount, this.enableRetry)) { | ||
yield res; | ||
@@ -848,2 +854,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/events/topics/${topicHash}/?${urlParams}`; | ||
let startTime; | ||
@@ -859,6 +866,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -893,4 +900,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -926,2 +933,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/chains/?${urlParams}`; | ||
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/chains/?${urlParams}`, { | ||
@@ -933,6 +941,6 @@ headers: { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -967,4 +975,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -996,2 +1004,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/chains/status/?${urlParams}`; | ||
let startTime; | ||
@@ -1007,6 +1016,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -1041,4 +1050,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -1076,2 +1085,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/address/${walletAddress}/activity/?${urlParams}`; | ||
let startTime; | ||
@@ -1087,6 +1097,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -1121,4 +1131,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -1155,2 +1165,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/${chainName}/event/${eventType}/gas_prices/?${urlParams}`; | ||
let startTime; | ||
@@ -1166,6 +1177,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status, startTime); | ||
if (response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -1177,3 +1188,3 @@ catch (error) { | ||
error: true, | ||
error_code: response.status, | ||
error_code: response.status ?? 429, | ||
error_message: error.message | ||
@@ -1201,4 +1212,4 @@ }; | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -1205,0 +1216,0 @@ } |
@@ -10,7 +10,7 @@ import { SecurityService } from "./SecurityService"; | ||
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP"; | ||
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.5"; | ||
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.6"; | ||
export declare class Response<T> { | ||
data: T; | ||
error: boolean; | ||
error_code: number; | ||
error_code: number | string; | ||
error_message: string; | ||
@@ -23,2 +23,4 @@ } | ||
threadCount?: number; | ||
/** Toggle to turn on and off retry logic */ | ||
enableRetry?: boolean; | ||
} | ||
@@ -25,0 +27,0 @@ /** |
@@ -9,3 +9,3 @@ import { SecurityService } from "./SecurityService"; | ||
import { ApiKeyValidator } from "../util/ApiKeyValidator"; | ||
export const userAgent = "com.covalenthq.sdk.typescript/0.7.5"; | ||
export const userAgent = "com.covalenthq.sdk.typescript/0.7.6"; | ||
export class Response { | ||
@@ -18,12 +18,12 @@ } | ||
constructor(apiKey, settings) { | ||
const { debug = false, threadCount = 3 } = settings || {}; | ||
const { debug = false, threadCount = 3, enableRetry = true } = settings || {}; | ||
const validator = new ApiKeyValidator(apiKey); | ||
this._is_key_valid = validator.isValidApiKey(); | ||
this.SecurityService = new SecurityService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.BalanceService = new BalanceService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.BaseService = new BaseService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.NftService = new NftService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.PricingService = new PricingService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.TransactionService = new TransactionService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.XykService = new XykService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.SecurityService = new SecurityService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.BalanceService = new BalanceService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.BaseService = new BaseService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.NftService = new NftService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.PricingService = new PricingService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.TransactionService = new TransactionService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.XykService = new XykService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
} | ||
@@ -39,14 +39,14 @@ } | ||
constructor(apiKey, settings) { | ||
const { debug = false, threadCount = 3 } = settings || {}; | ||
const { debug = false, threadCount = 3, enableRetry = true } = settings || {}; | ||
const validator = new ApiKeyValidator(apiKey); | ||
this._is_key_valid = validator.isValidApiKey(); | ||
this.SecurityService = new SecurityService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.BalanceService = new BalanceService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.BaseService = new BaseService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.NftService = new NftService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.PricingService = new PricingService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.TransactionService = new TransactionService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.XykService = new XykService(apiKey, debug, threadCount, this._is_key_valid); | ||
this.SecurityService = new SecurityService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.BalanceService = new BalanceService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.BaseService = new BaseService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.NftService = new NftService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.PricingService = new PricingService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.TransactionService = new TransactionService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
this.XykService = new XykService(apiKey, debug, threadCount, this._is_key_valid, enableRetry); | ||
} | ||
} | ||
//# sourceMappingURL=CovalentClient.js.map |
@@ -487,4 +487,5 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -491,0 +492,0 @@ * |
@@ -73,4 +73,5 @@ import { Chain, Quote } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -77,0 +78,0 @@ * |
@@ -46,3 +46,3 @@ import { userAgent } from "./CovalentClient"; | ||
export class PricingService { | ||
constructor(apiKey, debug = false, threadCount = 3, is_key_valid) { | ||
constructor(apiKey, debug = false, threadCount = 3, is_key_valid, enableRetry = true) { | ||
this.apiKey = apiKey; | ||
@@ -52,2 +52,3 @@ this.debug = debug; | ||
this.is_key_valid = is_key_valid; | ||
this.enableRetry = enableRetry; | ||
this.LIMIT = pLimit(this.threadCount); | ||
@@ -93,2 +94,3 @@ } | ||
} | ||
const url = `https://api.covalenthq.com/v1/pricing/historical_by_addresses_v2/${chainName}/${quoteCurrency}/${contractAddress}/?${urlParams}`; | ||
let startTime; | ||
@@ -104,6 +106,6 @@ if (this.debug) { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -142,4 +144,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -146,0 +148,0 @@ } |
@@ -140,4 +140,5 @@ import { Chain, Response } from "./CovalentClient"; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -144,0 +145,0 @@ * |
@@ -94,3 +94,3 @@ import { userAgent } from "./CovalentClient"; | ||
export class SecurityService { | ||
constructor(apiKey, debug = false, threadCount = 3, is_key_valid) { | ||
constructor(apiKey, debug = false, threadCount = 3, is_key_valid, enableRetry = true) { | ||
this.apiKey = apiKey; | ||
@@ -100,2 +100,3 @@ this.debug = debug; | ||
this.is_key_valid = is_key_valid; | ||
this.enableRetry = enableRetry; | ||
this.LIMIT = pLimit(this.threadCount); | ||
@@ -119,2 +120,3 @@ } | ||
const urlParams = new URLSearchParams(); | ||
const url = `https://api.covalenthq.com/v1/${chainName}/approvals/${walletAddress}/?${urlParams}`; | ||
if (!this.is_key_valid) { | ||
@@ -138,6 +140,6 @@ return { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -172,4 +174,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -194,2 +196,3 @@ } | ||
const urlParams = new URLSearchParams(); | ||
const url = `https://api.covalenthq.com/v1/${chainName}/nft/approvals/${walletAddress}/?${urlParams}`; | ||
if (!this.is_key_valid) { | ||
@@ -213,6 +216,6 @@ return { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await this.LIMIT(() => backoff.backOff(response.url)); | ||
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url)); | ||
} | ||
@@ -247,4 +250,4 @@ catch (error) { | ||
error: true, | ||
error_code: data ? data.error_code : response.status, | ||
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required" | ||
error_code: error.cause ? error.cause.code : data ? data.error_code : response ? response.status : "Unknown Error Code", | ||
error_message: error.cause ? error.cause.message : data ? data.error_message : response && response.status === 500 ? "Internal server error" : !response ? "Unknown Error" : "401 Authorization Required" | ||
}; | ||
@@ -251,0 +254,0 @@ } |
@@ -342,2 +342,3 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -358,3 +359,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<RecentTransactionsResponse>>; | ||
@@ -417,2 +418,3 @@ next(): Promise<Response<RecentTransactionsResponse>>; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -433,3 +435,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<TransactionsResponse>>; | ||
@@ -443,2 +445,3 @@ next(): Promise<Response<TransactionsResponse>>; | ||
private _urlParams; | ||
private _enableRetry; | ||
/** * The requested address. */ | ||
@@ -460,3 +463,3 @@ address: string; | ||
items: Transaction[]; | ||
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams); | ||
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean); | ||
prev(): Promise<Response<TransactionsTimeBucketResponse>>; | ||
@@ -520,4 +523,5 @@ next(): Promise<Response<TransactionsTimeBucketResponse>>; | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -524,0 +528,0 @@ * |
@@ -259,2 +259,4 @@ import { Chain, Quote, Response } from "./CovalentClient"; | ||
fee_24h_quote: number; | ||
/** * The annual fee percentage. */ | ||
annualized_fee: number; | ||
/** * A prettier version of the volume 24h quote for rendering purposes. */ | ||
@@ -320,2 +322,4 @@ pretty_volume_24h_quote: string; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -337,2 +341,4 @@ quote_rate: number; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -450,2 +456,26 @@ quote_rate: number; | ||
pretty_total_quote: string; | ||
/** * The value attached to this tx. */ | ||
value: bigint | null; | ||
/** * The value attached in `quote-currency` to this tx. */ | ||
value_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_value_quote: string; | ||
/** * The requested chain native gas token metadata. */ | ||
gas_metadata: ContractMetadata; | ||
/** * The amount of gas supplied for this tx. */ | ||
gas_offered: string; | ||
/** * The gas spent for this tx. */ | ||
gas_spent: string; | ||
/** * The gas price at the time of this tx. */ | ||
gas_price: string; | ||
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */ | ||
fees_paid: bigint | null; | ||
/** * The gas spent in `quote-currency` denomination. */ | ||
gas_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_gas_quote: string; | ||
/** * The native gas exchange rate for the requested `quote-currency`. */ | ||
gas_quote_rate: number; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
token_0: PoolToken; | ||
@@ -457,2 +487,17 @@ token_1: PoolToken; | ||
} | ||
declare class ContractMetadata { | ||
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
contract_decimals: number; | ||
/** * The string returned by the `name()` method. */ | ||
contract_name: string; | ||
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */ | ||
contract_ticker_symbol: string; | ||
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */ | ||
contract_address: string; | ||
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ | ||
supports_erc: string; | ||
/** * The contract logo URL. */ | ||
logo_url: string; | ||
constructor(data: ContractMetadata); | ||
} | ||
declare class PoolToken { | ||
@@ -520,9 +565,13 @@ /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
gas_token_price_quote: number; | ||
total_swaps24h: number; | ||
total_active_pairs7d: number; | ||
total_fees24h: number; | ||
volume_chart7d: VolumeEcosystemChart[]; | ||
volume_chart30d: VolumeEcosystemChart[]; | ||
liquidity_chart7d: LiquidityEcosystemChart[]; | ||
liquidity_chart30d: LiquidityEcosystemChart[]; | ||
total_swaps_24h: number; | ||
total_active_pairs_7d: number; | ||
total_fees_24h: number; | ||
/** * A prettier version of the gas quote for rendering purposes. */ | ||
pretty_gas_token_price_quote: string; | ||
/** * A prettier version of the 24h total fees for rendering purposes. */ | ||
pretty_total_fees_24h: string; | ||
volume_chart_7d: VolumeEcosystemChart[]; | ||
volume_chart_30d: VolumeEcosystemChart[]; | ||
liquidity_chart_7d: LiquidityEcosystemChart[]; | ||
liquidity_chart_30d: LiquidityEcosystemChart[]; | ||
constructor(data: UniswapLikeEcosystemCharts); | ||
@@ -539,2 +588,4 @@ } | ||
volume_quote: number; | ||
/** * A prettier version of the volume quote for rendering purposes. */ | ||
pretty_volume_quote: string; | ||
swap_count_24: number; | ||
@@ -552,2 +603,4 @@ constructor(data: VolumeEcosystemChart); | ||
liquidity_quote: number; | ||
/** * A prettier version of the liquidity quote for rendering purposes. */ | ||
pretty_liquidity_quote: string; | ||
constructor(data: LiquidityEcosystemChart); | ||
@@ -598,4 +651,5 @@ } | ||
private is_key_valid; | ||
private enableRetry; | ||
private LIMIT; | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean); | ||
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean); | ||
/** | ||
@@ -602,0 +656,0 @@ * |
export declare function checkAndModifyResponse(jsonObj: any): void; | ||
export declare function debugOutput(url: string, responseStatus: number, startTime: number | [number, number] | undefined): Promise<void>; | ||
type Constructor<T> = new (...args: any[]) => T; | ||
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number): AsyncIterable<T1>; | ||
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number, enableRetry: boolean): AsyncIterable<T1>; | ||
export {}; |
@@ -31,3 +31,3 @@ import { ExponentialBackoff } from "./backoff"; | ||
} | ||
export async function* paginateEndpoint(url, apiKey, urlsParams, dataClassConstructor, debug, threadCount) { | ||
export async function* paginateEndpoint(url, apiKey, urlsParams, dataClassConstructor, debug, threadCount, enableRetry) { | ||
let hasNext = true; | ||
@@ -45,2 +45,3 @@ let response; | ||
} | ||
const link = urlsParams.get("page-number") ? `${url}?${urlsParams}` : `${url}?${urlsParams}&page-number=${page_number}`; | ||
response = await LIMIT(() => fetch(urlsParams.get("page-number") ? `${url}?${urlsParams}` : `${url}?${urlsParams}&page-number=${page_number}`, { | ||
@@ -52,10 +53,10 @@ headers: { | ||
})); | ||
debugOutput(response.url, response.status ?? 429, startTime); | ||
if (response.status === null || response.status === 429) { | ||
debugOutput(response ? response.url : url, response ? response.status : 429, startTime); | ||
if ((enableRetry === true) && (!response || response.status === null || response.status === 429)) { | ||
try { | ||
data = await LIMIT(() => backoff.backOff(response.url)); | ||
data = await LIMIT(() => backoff.backOff(response ? response.url : link)); | ||
} | ||
catch (error) { | ||
hasNext = false; | ||
throw new Error(`An error occurred ${response.status ?? 429}: ${error.message}`); | ||
throw new Error(`An error occurred ${response ? response.status : 429}: ${error.message}`); | ||
} | ||
@@ -62,0 +63,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Pagination } from "./GenericTypes"; | ||
import { Pagination, ContractMetadata } from "./GenericTypes"; | ||
export interface PoolResponse { | ||
@@ -235,2 +235,4 @@ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
fee_24h_quote: number; | ||
/** * The annual fee percentage. */ | ||
annualized_fee: number; | ||
/** * A prettier version of the volume 24h quote for rendering purposes. */ | ||
@@ -292,2 +294,4 @@ pretty_volume_24h_quote: string; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -308,2 +312,4 @@ quote_rate: number; | ||
quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * The exchange rate for the requested quote currency. */ | ||
@@ -415,2 +421,26 @@ quote_rate: number; | ||
pretty_total_quote: string; | ||
/** * The value attached to this tx. */ | ||
value: bigint | null; | ||
/** * The value attached in `quote-currency` to this tx. */ | ||
value_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_value_quote: string; | ||
/** * The requested chain native gas token metadata. */ | ||
gas_metadata: ContractMetadata; | ||
/** * The amount of gas supplied for this tx. */ | ||
gas_offered: string; | ||
/** * The gas spent for this tx. */ | ||
gas_spent: string; | ||
/** * The gas price at the time of this tx. */ | ||
gas_price: string; | ||
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */ | ||
fees_paid: bigint | null; | ||
/** * The gas spent in `quote-currency` denomination. */ | ||
gas_quote: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_gas_quote: string; | ||
/** * The native gas exchange rate for the requested `quote-currency`. */ | ||
gas_quote_rate: number; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
token_0: PoolToken; | ||
@@ -479,9 +509,13 @@ token_1: PoolToken; | ||
gas_token_price_quote: number; | ||
total_swaps24h: number; | ||
total_active_pairs7d: number; | ||
total_fees24h: number; | ||
volume_chart7d: VolumeEcosystemChart[]; | ||
volume_chart30d: VolumeEcosystemChart[]; | ||
liquidity_chart7d: LiquidityEcosystemChart[]; | ||
liquidity_chart30d: LiquidityEcosystemChart[]; | ||
total_swaps_24h: number; | ||
total_active_pairs_7d: number; | ||
total_fees_24h: number; | ||
/** * A prettier version of the gas quote for rendering purposes. */ | ||
pretty_gas_token_price_quote: string; | ||
/** * A prettier version of the 24h total fees for rendering purposes. */ | ||
pretty_total_fees_24h: string; | ||
volume_chart_7d: VolumeEcosystemChart[]; | ||
volume_chart_30d: VolumeEcosystemChart[]; | ||
liquidity_chart_7d: LiquidityEcosystemChart[]; | ||
liquidity_chart_30d: LiquidityEcosystemChart[]; | ||
} | ||
@@ -497,2 +531,4 @@ export interface VolumeEcosystemChart { | ||
volume_quote: number; | ||
/** * A prettier version of the volume quote for rendering purposes. */ | ||
pretty_volume_quote: string; | ||
swap_count_24: number; | ||
@@ -509,2 +545,4 @@ } | ||
liquidity_quote: number; | ||
/** * A prettier version of the liquidity quote for rendering purposes. */ | ||
pretty_liquidity_quote: string; | ||
} | ||
@@ -511,0 +549,0 @@ export interface HealthDataResponse { |
{ | ||
"name": "@covalenthq/client-sdk", | ||
"version": "0.7.5", | ||
"version": "0.7.6", | ||
"types": "dist/index.d.ts", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -0,1 +1,11 @@ | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/@covalenthq/client-sdk"> | ||
<img src="https://img.shields.io/npm/v/@covalenthq/client-sdk" alt="NPM"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/@covalenthq/client-sdk"> | ||
<img src="https://img.shields.io/npm/dm/@covalenthq/client-sdk" alt="npm downloads"> | ||
</a> | ||
</p> | ||
# Covalent SDK for TypeScript | ||
@@ -300,2 +310,12 @@ | ||
Users have the ability to control the retry feature through the enableRetry configuration setting. By default, this feature is enabled `true`. However, users can deactivate it by setting `enableRetry` to `false`. | ||
```ts | ||
import { CovalentClient, CovalentClientSettings } from "@covalenthq/client-sdk"; | ||
const settings: CovalentClientSettings = { | ||
enableRetry: false | ||
} | ||
``` | ||
### Error Handling | ||
@@ -302,0 +322,0 @@ The paginated endpoints throw an error message in this format: `An error occurred {error_code}: {error_message}`. The developer will need to `catch` these errors. Note - these endpoints do not follow the default response format which is: |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5252571
52980
358