@covalenthq/client-sdk 0.7.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/cjs/index.js +1183 -451
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/BalanceService.d.ts +15 -13
- package/dist/cjs/services/BaseService.d.ts +13 -11
- package/dist/cjs/services/CovalentClient.d.ts +8 -4
- package/dist/cjs/services/NftService.d.ts +19 -17
- package/dist/cjs/services/PricingService.d.ts +5 -3
- package/dist/cjs/services/SecurityService.d.ts +6 -4
- package/dist/cjs/services/TransactionService.d.ts +83 -12
- package/dist/cjs/services/XykService.d.ts +287 -22
- package/dist/cjs/util/ApiHelpers.d.ts +2 -1
- package/dist/cjs/util/backoff.d.ts +2 -1
- package/dist/cjs/util/types/TransactionServiceTypes.d.ts +11 -0
- package/dist/cjs/util/types/XykServiceTypes.d.ts +160 -8
- package/dist/es/index.js +1183 -451
- package/dist/es/index.js.map +1 -1
- package/dist/es/services/BalanceService.d.ts +15 -13
- package/dist/es/services/BaseService.d.ts +13 -11
- package/dist/es/services/CovalentClient.d.ts +8 -4
- package/dist/es/services/NftService.d.ts +19 -17
- package/dist/es/services/PricingService.d.ts +5 -3
- package/dist/es/services/SecurityService.d.ts +6 -4
- package/dist/es/services/TransactionService.d.ts +83 -12
- package/dist/es/services/XykService.d.ts +287 -22
- package/dist/es/util/ApiHelpers.d.ts +2 -1
- package/dist/es/util/backoff.d.ts +2 -1
- package/dist/es/util/types/TransactionServiceTypes.d.ts +11 -0
- package/dist/es/util/types/XykServiceTypes.d.ts +160 -8
- package/dist/esm/index.js +1183 -451
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/BalanceService.d.ts +15 -13
- package/dist/esm/services/BaseService.d.ts +13 -11
- package/dist/esm/services/CovalentClient.d.ts +8 -4
- package/dist/esm/services/NftService.d.ts +19 -17
- package/dist/esm/services/PricingService.d.ts +5 -3
- package/dist/esm/services/SecurityService.d.ts +6 -4
- package/dist/esm/services/TransactionService.d.ts +83 -12
- package/dist/esm/services/XykService.d.ts +287 -22
- package/dist/esm/util/ApiHelpers.d.ts +2 -1
- package/dist/esm/util/backoff.d.ts +2 -1
- package/dist/esm/util/types/TransactionServiceTypes.d.ts +11 -0
- package/dist/esm/util/types/XykServiceTypes.d.ts +160 -8
- package/dist/services/BalanceService.d.ts +15 -13
- package/dist/services/BalanceService.js +47 -39
- package/dist/services/BalanceService.js.map +1 -1
- package/dist/services/BaseService.d.ts +13 -11
- package/dist/services/BaseService.js +77 -65
- package/dist/services/BaseService.js.map +1 -1
- package/dist/services/CovalentClient.d.ts +8 -4
- package/dist/services/CovalentClient.js +19 -19
- package/dist/services/CovalentClient.js.map +1 -1
- package/dist/services/NftService.d.ts +19 -17
- package/dist/services/NftService.js +96 -81
- package/dist/services/NftService.js.map +1 -1
- package/dist/services/PricingService.d.ts +5 -3
- package/dist/services/PricingService.js +10 -7
- package/dist/services/PricingService.js.map +1 -1
- package/dist/services/SecurityService.d.ts +6 -4
- package/dist/services/SecurityService.js +17 -13
- package/dist/services/SecurityService.js.map +1 -1
- package/dist/services/TransactionService.d.ts +83 -12
- package/dist/services/TransactionService.js +434 -90
- package/dist/services/TransactionService.js.map +1 -1
- package/dist/services/XykService.d.ts +287 -22
- package/dist/services/XykService.js +438 -93
- package/dist/services/XykService.js.map +1 -1
- package/dist/util/ApiHelpers.d.ts +2 -1
- package/dist/util/ApiHelpers.js +7 -6
- package/dist/util/ApiHelpers.js.map +1 -1
- package/dist/util/backoff.d.ts +2 -1
- package/dist/util/backoff.js +3 -3
- package/dist/util/backoff.js.map +1 -1
- package/dist/util/types/TransactionServiceTypes.d.ts +11 -0
- package/dist/util/types/XykServiceTypes.d.ts +160 -8
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Chain, Quote, Response } from "./CovalentClient";
|
|
1
|
+
import { Chain, Quote, Response, ChainID, Source } from "./CovalentClient";
|
|
2
2
|
import { Chains } from "../util/Chains";
|
|
3
3
|
declare class PoolResponse {
|
|
4
4
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
@@ -256,6 +256,8 @@ declare class PoolsDexDataItem {
|
|
|
256
256
|
volume_7d_quote: number;
|
|
257
257
|
/** * The fee 24h converted to fiat in `quote-currency`. */
|
|
258
258
|
fee_24h_quote: number;
|
|
259
|
+
/** * The annual fee percentage. */
|
|
260
|
+
annualized_fee: number;
|
|
259
261
|
/** * A prettier version of the volume 24h quote for rendering purposes. */
|
|
260
262
|
pretty_volume_24h_quote: string;
|
|
261
263
|
/** * A prettier version of the volume 7d quote for rendering purposes. */
|
|
@@ -316,6 +318,8 @@ declare class UniswapLikeToken {
|
|
|
316
318
|
/** * The asset balance. Use `contract_decimals` to scale this balance for display purposes. */
|
|
317
319
|
balance: bigint | null;
|
|
318
320
|
quote: number;
|
|
321
|
+
/** * A prettier version of the quote for rendering purposes. */
|
|
322
|
+
pretty_quote: string;
|
|
319
323
|
/** * The exchange rate for the requested quote currency. */
|
|
320
324
|
quote_rate: number;
|
|
321
325
|
constructor(data: UniswapLikeToken);
|
|
@@ -332,6 +336,8 @@ declare class UniswapLikeTokenWithSupply {
|
|
|
332
336
|
/** * The asset balance. Use `contract_decimals` to scale this balance for display purposes. */
|
|
333
337
|
balance: bigint | null;
|
|
334
338
|
quote: number;
|
|
339
|
+
/** * A prettier version of the quote for rendering purposes. */
|
|
340
|
+
pretty_quote: string;
|
|
335
341
|
/** * The exchange rate for the requested quote currency. */
|
|
336
342
|
quote_rate: number;
|
|
337
343
|
/** * Total supply of this pool token. */
|
|
@@ -389,6 +395,113 @@ declare class TokenV2Volume {
|
|
|
389
395
|
total_volume_24h_quote: number;
|
|
390
396
|
constructor(data: TokenV2Volume);
|
|
391
397
|
}
|
|
398
|
+
declare class NetworkExchangeTokenViewResponse {
|
|
399
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
400
|
+
updated_at: Date;
|
|
401
|
+
/** * The requested chain ID eg: `1`. */
|
|
402
|
+
chain_id: number;
|
|
403
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
404
|
+
chain_name: string;
|
|
405
|
+
/** * List of response items. */
|
|
406
|
+
items: TokenV2VolumeWithChartData[];
|
|
407
|
+
/** * Pagination metadata. */
|
|
408
|
+
pagination: Pagination;
|
|
409
|
+
constructor(data: NetworkExchangeTokenViewResponse);
|
|
410
|
+
}
|
|
411
|
+
declare class TokenV2VolumeWithChartData {
|
|
412
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
413
|
+
chain_name: string;
|
|
414
|
+
/** * The requested chain ID eg: `1`. */
|
|
415
|
+
chain_id: string;
|
|
416
|
+
/** * The name of the DEX, eg: `uniswap_v2`. */
|
|
417
|
+
dex_name: string;
|
|
418
|
+
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
|
|
419
|
+
contract_address: string;
|
|
420
|
+
/** * The string returned by the `name()` method. */
|
|
421
|
+
contract_name: string;
|
|
422
|
+
/** * The total liquidity unscaled value. */
|
|
423
|
+
total_liquidity: number;
|
|
424
|
+
/** * The total volume 24h unscaled value. */
|
|
425
|
+
total_volume_24h: number;
|
|
426
|
+
/** * The contract logo URL. */
|
|
427
|
+
logo_url: string;
|
|
428
|
+
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
|
|
429
|
+
contract_ticker_symbol: string;
|
|
430
|
+
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
431
|
+
contract_decimals: number;
|
|
432
|
+
/** * The total amount of swaps in the last 24h. */
|
|
433
|
+
swap_count_24h: number;
|
|
434
|
+
/** * The exchange rate for the requested quote currency. */
|
|
435
|
+
quote_rate: number;
|
|
436
|
+
/** * The 24h exchange rate for the requested quote currency. */
|
|
437
|
+
quote_rate_24h: number;
|
|
438
|
+
/** * A prettier version of the exchange rate for rendering purposes. */
|
|
439
|
+
pretty_quote_rate: string;
|
|
440
|
+
/** * A prettier version of the 24h exchange rate for rendering purposes. */
|
|
441
|
+
pretty_quote_rate_24h: string;
|
|
442
|
+
/** * A prettier version of the total liquidity quote for rendering purposes. */
|
|
443
|
+
pretty_total_liquidity_quote: string;
|
|
444
|
+
/** * A prettier version of the 24h volume quote for rendering purposes. */
|
|
445
|
+
pretty_total_volume_24h_quote: string;
|
|
446
|
+
/** * The total liquidity converted to fiat in `quote-currency`. */
|
|
447
|
+
total_liquidity_quote: number;
|
|
448
|
+
/** * The total volume 24h converted to fiat in `quote-currency`. */
|
|
449
|
+
total_volume_24h_quote: number;
|
|
450
|
+
/** * The number of transactions in the last 24h. */
|
|
451
|
+
transactions_24h: number;
|
|
452
|
+
volume_timeseries_7d: VolumeTokenTimeseries[];
|
|
453
|
+
volume_timeseries_30d: VolumeTokenTimeseries[];
|
|
454
|
+
liquidity_timeseries_7d: LiquidityTokenTimeseries[];
|
|
455
|
+
liquidity_timeseries_30d: LiquidityTokenTimeseries[];
|
|
456
|
+
price_timeseries_7d: PriceTokenTimeseries[];
|
|
457
|
+
price_timeseries_30d: PriceTokenTimeseries[];
|
|
458
|
+
constructor(data: TokenV2VolumeWithChartData);
|
|
459
|
+
}
|
|
460
|
+
declare class VolumeTokenTimeseries {
|
|
461
|
+
/** * The name of the DEX, eg: `uniswap_v2`. */
|
|
462
|
+
dex_name: string;
|
|
463
|
+
/** * The requested chain ID eg: `1`. */
|
|
464
|
+
chain_id: string;
|
|
465
|
+
/** * The current date. */
|
|
466
|
+
dt: string;
|
|
467
|
+
/** * The total volume unscaled for this day. */
|
|
468
|
+
total_volume: string;
|
|
469
|
+
/** * The volume in `quote-currency` denomination. */
|
|
470
|
+
volume_quote: number;
|
|
471
|
+
/** * A prettier version of the volume quote for rendering purposes. */
|
|
472
|
+
pretty_volume_quote: string;
|
|
473
|
+
constructor(data: VolumeTokenTimeseries);
|
|
474
|
+
}
|
|
475
|
+
declare class LiquidityTokenTimeseries {
|
|
476
|
+
/** * The name of the DEX, eg: `uniswap_v2`. */
|
|
477
|
+
dex_name: string;
|
|
478
|
+
/** * The requested chain ID eg: `1`. */
|
|
479
|
+
chain_id: string;
|
|
480
|
+
/** * The current date. */
|
|
481
|
+
dt: string;
|
|
482
|
+
/** * The total liquidity unscaled up to this day. */
|
|
483
|
+
total_liquidity: string;
|
|
484
|
+
/** * The liquidity in `quote-currency` denomination. */
|
|
485
|
+
liquidity_quote: number;
|
|
486
|
+
/** * A prettier version of the liquidity quote for rendering purposes. */
|
|
487
|
+
pretty_liquidity_quote: string;
|
|
488
|
+
constructor(data: LiquidityTokenTimeseries);
|
|
489
|
+
}
|
|
490
|
+
declare class PriceTokenTimeseries {
|
|
491
|
+
/** * The name of the DEX, eg: `uniswap_v2`. */
|
|
492
|
+
dex_name: string;
|
|
493
|
+
/** * The requested chain ID eg: `1`. */
|
|
494
|
+
chain_id: string;
|
|
495
|
+
/** * The current date. */
|
|
496
|
+
dt: string;
|
|
497
|
+
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
498
|
+
quote_currency: string;
|
|
499
|
+
/** * The exchange rate for the requested quote currency. */
|
|
500
|
+
quote_rate: number;
|
|
501
|
+
/** * A prettier version of the exchange rate for rendering purposes. */
|
|
502
|
+
pretty_quote_rate: string;
|
|
503
|
+
constructor(data: PriceTokenTimeseries);
|
|
504
|
+
}
|
|
392
505
|
declare class SupportedDexesResponse {
|
|
393
506
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
394
507
|
updated_at: Date;
|
|
@@ -444,12 +557,51 @@ declare class ExchangeTransaction {
|
|
|
444
557
|
total_quote: number;
|
|
445
558
|
/** * A prettier version of the total quote for rendering purposes. */
|
|
446
559
|
pretty_total_quote: string;
|
|
560
|
+
/** * The value attached to this tx. */
|
|
561
|
+
value: bigint | null;
|
|
562
|
+
/** * The value attached in `quote-currency` to this tx. */
|
|
563
|
+
value_quote: number;
|
|
564
|
+
/** * A prettier version of the quote for rendering purposes. */
|
|
565
|
+
pretty_value_quote: string;
|
|
566
|
+
/** * The requested chain native gas token metadata. */
|
|
567
|
+
gas_metadata: ContractMetadata;
|
|
568
|
+
/** * The amount of gas supplied for this tx. */
|
|
569
|
+
gas_offered: string;
|
|
570
|
+
/** * The gas spent for this tx. */
|
|
571
|
+
gas_spent: string;
|
|
572
|
+
/** * The gas price at the time of this tx. */
|
|
573
|
+
gas_price: string;
|
|
574
|
+
/** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */
|
|
575
|
+
fees_paid: bigint | null;
|
|
576
|
+
/** * The gas spent in `quote-currency` denomination. */
|
|
577
|
+
gas_quote: number;
|
|
578
|
+
/** * A prettier version of the quote for rendering purposes. */
|
|
579
|
+
pretty_gas_quote: string;
|
|
580
|
+
/** * The native gas exchange rate for the requested `quote-currency`. */
|
|
581
|
+
gas_quote_rate: number;
|
|
582
|
+
/** * The requested quote currency eg: `USD`. */
|
|
583
|
+
quote_currency: string;
|
|
447
584
|
token_0: PoolToken;
|
|
448
585
|
token_1: PoolToken;
|
|
449
586
|
token_0_quote_rate: number;
|
|
450
587
|
token_1_quote_rate: number;
|
|
451
588
|
constructor(data: ExchangeTransaction);
|
|
452
589
|
}
|
|
590
|
+
declare class ContractMetadata {
|
|
591
|
+
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
592
|
+
contract_decimals: number;
|
|
593
|
+
/** * The string returned by the `name()` method. */
|
|
594
|
+
contract_name: string;
|
|
595
|
+
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
|
|
596
|
+
contract_ticker_symbol: string;
|
|
597
|
+
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
|
|
598
|
+
contract_address: string;
|
|
599
|
+
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
|
|
600
|
+
supports_erc: string;
|
|
601
|
+
/** * The contract logo URL. */
|
|
602
|
+
logo_url: string;
|
|
603
|
+
constructor(data: ContractMetadata);
|
|
604
|
+
}
|
|
453
605
|
declare class PoolToken {
|
|
454
606
|
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
455
607
|
contract_decimals: number;
|
|
@@ -491,6 +643,19 @@ declare class TransactionsForExchangeResponse {
|
|
|
491
643
|
pagination: Pagination;
|
|
492
644
|
constructor(data: TransactionsForExchangeResponse);
|
|
493
645
|
}
|
|
646
|
+
declare class NetworkTransactionsResponse {
|
|
647
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
648
|
+
updated_at: Date;
|
|
649
|
+
/** * The requested chain ID eg: `1`. */
|
|
650
|
+
chain_id: number;
|
|
651
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
652
|
+
chain_name: string;
|
|
653
|
+
/** * List of response items. */
|
|
654
|
+
items: ExchangeTransaction[];
|
|
655
|
+
/** * Pagination metadata. */
|
|
656
|
+
pagination: Pagination;
|
|
657
|
+
constructor(data: NetworkTransactionsResponse);
|
|
658
|
+
}
|
|
494
659
|
declare class EcosystemChartDataResponse {
|
|
495
660
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
496
661
|
updated_at: Date;
|
|
@@ -512,13 +677,17 @@ declare class UniswapLikeEcosystemCharts {
|
|
|
512
677
|
/** * The requested quote currency eg: `USD`. */
|
|
513
678
|
quote_currency: string;
|
|
514
679
|
gas_token_price_quote: number;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
680
|
+
total_swaps_24h: number;
|
|
681
|
+
total_active_pairs_7d: number;
|
|
682
|
+
total_fees_24h: number;
|
|
683
|
+
/** * A prettier version of the gas quote for rendering purposes. */
|
|
684
|
+
pretty_gas_token_price_quote: string;
|
|
685
|
+
/** * A prettier version of the 24h total fees for rendering purposes. */
|
|
686
|
+
pretty_total_fees_24h: string;
|
|
687
|
+
volume_chart_7d: VolumeEcosystemChart[];
|
|
688
|
+
volume_chart_30d: VolumeEcosystemChart[];
|
|
689
|
+
liquidity_chart_7d: LiquidityEcosystemChart[];
|
|
690
|
+
liquidity_chart_30d: LiquidityEcosystemChart[];
|
|
522
691
|
constructor(data: UniswapLikeEcosystemCharts);
|
|
523
692
|
}
|
|
524
693
|
declare class VolumeEcosystemChart {
|
|
@@ -530,6 +699,8 @@ declare class VolumeEcosystemChart {
|
|
|
530
699
|
/** * The requested quote currency eg: `USD`. */
|
|
531
700
|
quote_currency: string;
|
|
532
701
|
volume_quote: number;
|
|
702
|
+
/** * A prettier version of the volume quote for rendering purposes. */
|
|
703
|
+
pretty_volume_quote: string;
|
|
533
704
|
swap_count_24: number;
|
|
534
705
|
constructor(data: VolumeEcosystemChart);
|
|
535
706
|
}
|
|
@@ -542,6 +713,8 @@ declare class LiquidityEcosystemChart {
|
|
|
542
713
|
/** * The requested quote currency eg: `USD`. */
|
|
543
714
|
quote_currency: string;
|
|
544
715
|
liquidity_quote: number;
|
|
716
|
+
/** * A prettier version of the liquidity quote for rendering purposes. */
|
|
717
|
+
pretty_liquidity_quote: string;
|
|
545
718
|
constructor(data: LiquidityEcosystemChart);
|
|
546
719
|
}
|
|
547
720
|
declare class HealthDataResponse {
|
|
@@ -564,11 +737,19 @@ declare class HealthData {
|
|
|
564
737
|
latest_block_signed_at: Date;
|
|
565
738
|
constructor(data: HealthData);
|
|
566
739
|
}
|
|
740
|
+
export interface GetPoolsQueryParamOpts {
|
|
741
|
+
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
742
|
+
pageSize?: number;
|
|
743
|
+
/** * 0-indexed page number to begin pagination. */
|
|
744
|
+
pageNumber?: number;
|
|
745
|
+
}
|
|
567
746
|
export interface GetPoolsForTokenAddressQueryParamOpts {
|
|
568
747
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
569
748
|
quoteCurrency?: Quote;
|
|
570
749
|
/** * The DEX name eg: `uniswap_v2`. */
|
|
571
750
|
dexName?: string;
|
|
751
|
+
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
752
|
+
pageSize?: number;
|
|
572
753
|
}
|
|
573
754
|
export interface GetPoolsForWalletAddressQueryParamOpts {
|
|
574
755
|
/** * The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. */
|
|
@@ -577,6 +758,44 @@ export interface GetPoolsForWalletAddressQueryParamOpts {
|
|
|
577
758
|
quoteCurrency?: Quote;
|
|
578
759
|
/** * The DEX name eg: `uniswap_v2`. */
|
|
579
760
|
dexName?: string;
|
|
761
|
+
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
762
|
+
pageSize?: number;
|
|
763
|
+
}
|
|
764
|
+
export interface GetNetworkExchangeTokensQueryParamOpts {
|
|
765
|
+
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
766
|
+
pageSize?: number;
|
|
767
|
+
/** * 0-indexed page number to begin pagination. */
|
|
768
|
+
pageNumber?: number;
|
|
769
|
+
}
|
|
770
|
+
export interface GetLpTokenViewQueryParamOpts {
|
|
771
|
+
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
772
|
+
quoteCurrency?: Quote;
|
|
773
|
+
}
|
|
774
|
+
export interface GetSingleNetworkExchangeTokenQueryParamOpts {
|
|
775
|
+
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
776
|
+
pageSize?: number;
|
|
777
|
+
/** * 0-indexed page number to begin pagination. */
|
|
778
|
+
pageNumber?: number;
|
|
779
|
+
}
|
|
780
|
+
export interface GetTransactionsForTokenAddressQueryParamOpts {
|
|
781
|
+
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
782
|
+
pageSize?: number;
|
|
783
|
+
/** * 0-indexed page number to begin pagination. */
|
|
784
|
+
pageNumber?: number;
|
|
785
|
+
}
|
|
786
|
+
export interface GetTransactionsForExchangeQueryParamOpts {
|
|
787
|
+
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
788
|
+
pageSize?: number;
|
|
789
|
+
/** * 0-indexed page number to begin pagination. */
|
|
790
|
+
pageNumber?: number;
|
|
791
|
+
}
|
|
792
|
+
export interface GetTransactionsForDexQueryParamOpts {
|
|
793
|
+
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
794
|
+
quoteCurrency?: Quote;
|
|
795
|
+
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
796
|
+
pageSize?: number;
|
|
797
|
+
/** * 0-indexed page number to begin pagination. */
|
|
798
|
+
pageNumber?: number;
|
|
580
799
|
}
|
|
581
800
|
/**
|
|
582
801
|
* XYK APIs
|
|
@@ -587,17 +806,22 @@ export declare class XykService {
|
|
|
587
806
|
private debug;
|
|
588
807
|
private threadCount;
|
|
589
808
|
private is_key_valid;
|
|
809
|
+
private enableRetry;
|
|
810
|
+
private source;
|
|
590
811
|
private LIMIT;
|
|
591
|
-
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean);
|
|
812
|
+
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry: boolean, source: Source);
|
|
592
813
|
/**
|
|
593
814
|
*
|
|
594
815
|
* Commonly used to get all the pools of a particular DEX. Supports most common DEXs (Uniswap, SushiSwap, etc), and returns detailed trading data (volume, liquidity, swap counts, fees, LP token prices).
|
|
595
816
|
*
|
|
596
817
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
597
818
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
819
|
+
* @param {GetPoolsQueryParamOpts} queryParamOpts
|
|
820
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
821
|
+
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
598
822
|
*
|
|
599
823
|
*/
|
|
600
|
-
getPools(chainName: Chain | Chains, dexName: string): Promise<Response<PoolResponse>>;
|
|
824
|
+
getPools(chainName: Chain | Chains | ChainID, dexName: string, queryParamOpts?: GetPoolsQueryParamOpts): Promise<Response<PoolResponse>>;
|
|
601
825
|
/**
|
|
602
826
|
*
|
|
603
827
|
* Commonly used to get the corresponding supported DEX given a pool address, along with the swap fees, DEX's logo url, and factory addresses. Useful to identifying the specific DEX to which a pair address is associated.
|
|
@@ -606,7 +830,7 @@ export declare class XykService {
|
|
|
606
830
|
* @param {string} poolAddress - The requested pool address.
|
|
607
831
|
*
|
|
608
832
|
*/
|
|
609
|
-
getDexForPoolAddress(chainName: Chain | Chains, poolAddress: string): Promise<Response<PoolToDexResponse>>;
|
|
833
|
+
getDexForPoolAddress(chainName: Chain | Chains | ChainID, poolAddress: string): Promise<Response<PoolToDexResponse>>;
|
|
610
834
|
/**
|
|
611
835
|
*
|
|
612
836
|
* Commonly used to get the 7 day and 30 day time-series data (volume, liquidity, price) of a particular liquidity pool in a DEX. Useful for building time-series charts on DEX trading activity.
|
|
@@ -616,7 +840,7 @@ export declare class XykService {
|
|
|
616
840
|
* @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
617
841
|
*
|
|
618
842
|
*/
|
|
619
|
-
getPoolByAddress(chainName: Chain | Chains, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
|
|
843
|
+
getPoolByAddress(chainName: Chain | Chains | ChainID, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
|
|
620
844
|
/**
|
|
621
845
|
*
|
|
622
846
|
* Commonly used to get all pools and the supported DEX for a token. Useful for building a table of top pairs across all supported DEXes that the token is trading on.
|
|
@@ -626,9 +850,11 @@ export declare class XykService {
|
|
|
626
850
|
* @param {number} page - The requested 0-indexed page number.
|
|
627
851
|
* @param {GetPoolsForTokenAddressQueryParamOpts} queryParamOpts
|
|
628
852
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
853
|
+
* - `dexName`: The DEX name eg: `uniswap_v2`.
|
|
854
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
629
855
|
*
|
|
630
856
|
*/
|
|
631
|
-
getPoolsForTokenAddress(chainName: Chain | Chains, tokenAddress: string, page: number, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
|
|
857
|
+
getPoolsForTokenAddress(chainName: Chain | Chains | ChainID, tokenAddress: string, page: number, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
|
|
632
858
|
/**
|
|
633
859
|
*
|
|
634
860
|
* Commonly used to return balance of a wallet/contract address on a specific DEX.
|
|
@@ -638,7 +864,7 @@ export declare class XykService {
|
|
|
638
864
|
* @param {string} accountAddress - The account address.
|
|
639
865
|
*
|
|
640
866
|
*/
|
|
641
|
-
getAddressExchangeBalances(chainName: Chain | Chains, dexName: string, accountAddress: string): Promise<Response<AddressExchangeBalancesResponse>>;
|
|
867
|
+
getAddressExchangeBalances(chainName: Chain | Chains | ChainID, dexName: string, accountAddress: string): Promise<Response<AddressExchangeBalancesResponse>>;
|
|
642
868
|
/**
|
|
643
869
|
*
|
|
644
870
|
* Commonly used to get all pools and supported DEX for a wallet. Useful for building a personal DEX UI showcasing pairs and supported DEXes associated to the wallet.
|
|
@@ -649,18 +875,35 @@ export declare class XykService {
|
|
|
649
875
|
* @param {GetPoolsForWalletAddressQueryParamOpts} queryParamOpts
|
|
650
876
|
* - `tokenAddress`: The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
651
877
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
878
|
+
* - `dexName`: The DEX name eg: `uniswap_v2`.
|
|
879
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
652
880
|
*
|
|
653
881
|
*/
|
|
654
|
-
getPoolsForWalletAddress(chainName: Chain | Chains, walletAddress: string, page: number, queryParamOpts?: GetPoolsForWalletAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
|
|
882
|
+
getPoolsForWalletAddress(chainName: Chain | Chains | ChainID, walletAddress: string, page: number, queryParamOpts?: GetPoolsForWalletAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
|
|
655
883
|
/**
|
|
656
884
|
*
|
|
657
885
|
* Commonly used to retrieve all network exchange tokens for a specific DEX. Useful for building a top tokens table by total liquidity within a particular DEX.
|
|
658
886
|
*
|
|
659
887
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
660
888
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
889
|
+
* @param {GetNetworkExchangeTokensQueryParamOpts} queryParamOpts
|
|
890
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
891
|
+
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
892
|
+
*
|
|
893
|
+
*/
|
|
894
|
+
getNetworkExchangeTokens(chainName: Chain | Chains | ChainID, dexName: string, queryParamOpts?: GetNetworkExchangeTokensQueryParamOpts): Promise<Response<NetworkExchangeTokensResponse>>;
|
|
895
|
+
/**
|
|
896
|
+
*
|
|
897
|
+
* Commonly used to get a detailed view for a single liquidity pool token. Includes time series data.
|
|
898
|
+
*
|
|
899
|
+
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
900
|
+
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
901
|
+
* @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
902
|
+
* @param {GetLpTokenViewQueryParamOpts} queryParamOpts
|
|
903
|
+
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
661
904
|
*
|
|
662
905
|
*/
|
|
663
|
-
|
|
906
|
+
getLpTokenView(chainName: Chain | Chains | ChainID, dexName: string, tokenAddress: string, queryParamOpts?: GetLpTokenViewQueryParamOpts): Promise<Response<NetworkExchangeTokenViewResponse>>;
|
|
664
907
|
/**
|
|
665
908
|
*
|
|
666
909
|
* Commonly used to get all the supported DEXs available for the xy=k endpoints, along with the swap fees and factory addresses.
|
|
@@ -675,9 +918,12 @@ export declare class XykService {
|
|
|
675
918
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
676
919
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
677
920
|
* @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
921
|
+
* @param {GetSingleNetworkExchangeTokenQueryParamOpts} queryParamOpts
|
|
922
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
923
|
+
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
678
924
|
*
|
|
679
925
|
*/
|
|
680
|
-
getSingleNetworkExchangeToken(chainName: Chain | Chains, dexName: string, tokenAddress: string): Promise<Response<SingleNetworkExchangeTokenResponse>>;
|
|
926
|
+
getSingleNetworkExchangeToken(chainName: Chain | Chains | ChainID, dexName: string, tokenAddress: string, queryParamOpts?: GetSingleNetworkExchangeTokenQueryParamOpts): Promise<Response<SingleNetworkExchangeTokenResponse>>;
|
|
681
927
|
/**
|
|
682
928
|
*
|
|
683
929
|
* Commonly used to get all the DEX transactions of a wallet. Useful for building tables of DEX activity segmented by wallet.
|
|
@@ -687,7 +933,7 @@ export declare class XykService {
|
|
|
687
933
|
* @param {string} accountAddress - The account address. Passing in an `ENS` or `RNS` resolves automatically.
|
|
688
934
|
*
|
|
689
935
|
*/
|
|
690
|
-
getTransactionsForAccountAddress(chainName: Chain | Chains, dexName: string, accountAddress: string): Promise<Response<TransactionsForAccountAddressResponse>>;
|
|
936
|
+
getTransactionsForAccountAddress(chainName: Chain | Chains | ChainID, dexName: string, accountAddress: string): Promise<Response<TransactionsForAccountAddressResponse>>;
|
|
691
937
|
/**
|
|
692
938
|
*
|
|
693
939
|
* Commonly used to get all the transactions of a token within a particular DEX. Useful for getting a per-token view of DEX activity.
|
|
@@ -695,9 +941,12 @@ export declare class XykService {
|
|
|
695
941
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
696
942
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
697
943
|
* @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
944
|
+
* @param {GetTransactionsForTokenAddressQueryParamOpts} queryParamOpts
|
|
945
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
946
|
+
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
698
947
|
*
|
|
699
948
|
*/
|
|
700
|
-
getTransactionsForTokenAddress(chainName: Chain | Chains, dexName: string, tokenAddress: string): Promise<Response<TransactionsForTokenAddressResponse>>;
|
|
949
|
+
getTransactionsForTokenAddress(chainName: Chain | Chains | ChainID, dexName: string, tokenAddress: string, queryParamOpts?: GetTransactionsForTokenAddressQueryParamOpts): Promise<Response<TransactionsForTokenAddressResponse>>;
|
|
701
950
|
/**
|
|
702
951
|
*
|
|
703
952
|
* Commonly used for getting all the transactions of a particular DEX liquidity pool. Useful for building a transactions history table for an individual pool.
|
|
@@ -705,9 +954,25 @@ export declare class XykService {
|
|
|
705
954
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
706
955
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
707
956
|
* @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
957
|
+
* @param {GetTransactionsForExchangeQueryParamOpts} queryParamOpts
|
|
958
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
959
|
+
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
960
|
+
*
|
|
961
|
+
*/
|
|
962
|
+
getTransactionsForExchange(chainName: Chain | Chains | ChainID, dexName: string, poolAddress: string, queryParamOpts?: GetTransactionsForExchangeQueryParamOpts): Promise<Response<TransactionsForExchangeResponse>>;
|
|
963
|
+
/**
|
|
964
|
+
*
|
|
965
|
+
* Commonly used to get all the the transactions for a given DEX. Useful for building DEX activity views.
|
|
966
|
+
*
|
|
967
|
+
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
968
|
+
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
969
|
+
* @param {GetTransactionsForDexQueryParamOpts} queryParamOpts
|
|
970
|
+
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
971
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
972
|
+
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
708
973
|
*
|
|
709
974
|
*/
|
|
710
|
-
|
|
975
|
+
getTransactionsForDex(chainName: Chain | Chains | ChainID, dexName: string, queryParamOpts?: GetTransactionsForDexQueryParamOpts): Promise<Response<NetworkTransactionsResponse>>;
|
|
711
976
|
/**
|
|
712
977
|
*
|
|
713
978
|
* Commonly used to get a 7d and 30d time-series chart of DEX activity. Includes volume and swap count.
|
|
@@ -716,7 +981,7 @@ export declare class XykService {
|
|
|
716
981
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
717
982
|
*
|
|
718
983
|
*/
|
|
719
|
-
getEcosystemChartData(chainName: Chain | Chains, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
|
|
984
|
+
getEcosystemChartData(chainName: Chain | Chains | ChainID, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
|
|
720
985
|
/**
|
|
721
986
|
*
|
|
722
987
|
* Commonly used to ping the health of xy=k endpoints to get the synced block height per chain.
|
|
@@ -725,6 +990,6 @@ export declare class XykService {
|
|
|
725
990
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
726
991
|
*
|
|
727
992
|
*/
|
|
728
|
-
getHealthData(chainName: Chain | Chains, dexName: string): Promise<Response<HealthDataResponse>>;
|
|
993
|
+
getHealthData(chainName: Chain | Chains | ChainID, dexName: string): Promise<Response<HealthDataResponse>>;
|
|
729
994
|
}
|
|
730
995
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Source } from "../services/CovalentClient";
|
|
1
2
|
export declare function checkAndModifyResponse(jsonObj: any): void;
|
|
2
3
|
export declare function debugOutput(url: string, responseStatus: number, startTime: number | [number, number] | undefined): Promise<void>;
|
|
3
4
|
type Constructor<T> = new (...args: any[]) => T;
|
|
4
|
-
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number): AsyncIterable<T1>;
|
|
5
|
+
export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number, enableRetry: boolean, source: Source): AsyncIterable<T1>;
|
|
5
6
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Source } from "../services/CovalentClient";
|
|
1
2
|
export declare const DEFAULT_BACKOFF_MAX_RETRIES = 5;
|
|
2
3
|
export declare const BASE_DELAY_MS = 1000;
|
|
3
4
|
export declare class ExponentialBackoff<T> {
|
|
@@ -6,6 +7,6 @@ export declare class ExponentialBackoff<T> {
|
|
|
6
7
|
_apiKey: string;
|
|
7
8
|
_debug: boolean;
|
|
8
9
|
constructor(apiKey: string, debug: boolean, maxRetries?: number);
|
|
9
|
-
backOff(url: string): Promise<T>;
|
|
10
|
+
backOff(url: string, source: Source): Promise<T>;
|
|
10
11
|
setNumAttempts(retryCount: number): void;
|
|
11
12
|
}
|
|
@@ -357,3 +357,14 @@ export interface TransactionsResponse {
|
|
|
357
357
|
/** * List of response items. */
|
|
358
358
|
items: Transaction[];
|
|
359
359
|
}
|
|
360
|
+
export interface TransactionsBlockPageResponse {
|
|
361
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
362
|
+
updated_at: Date;
|
|
363
|
+
/** * The requested chain ID eg: `1`. */
|
|
364
|
+
chain_id: number;
|
|
365
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
366
|
+
chain_name: string;
|
|
367
|
+
links: PaginationLinks;
|
|
368
|
+
/** * List of response items. */
|
|
369
|
+
items: Transaction[];
|
|
370
|
+
}
|