@covalenthq/client-sdk 0.7.6 → 0.8.1
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 +5 -0
- package/dist/cjs/index.js +2762 -199
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/BalanceService.d.ts +14 -13
- package/dist/cjs/services/BaseService.d.ts +12 -11
- package/dist/cjs/services/CovalentClient.d.ts +5 -3
- package/dist/cjs/services/NftService.d.ts +18 -17
- package/dist/cjs/services/PricingService.d.ts +4 -3
- package/dist/cjs/services/SecurityService.d.ts +5 -4
- package/dist/cjs/services/TransactionService.d.ts +79 -12
- package/dist/cjs/services/XykService.d.ts +226 -15
- 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 +114 -0
- package/dist/es/index.js +2762 -199
- package/dist/es/index.js.map +1 -1
- package/dist/es/services/BalanceService.d.ts +14 -13
- package/dist/es/services/BaseService.d.ts +12 -11
- package/dist/es/services/CovalentClient.d.ts +5 -3
- package/dist/es/services/NftService.d.ts +18 -17
- package/dist/es/services/PricingService.d.ts +4 -3
- package/dist/es/services/SecurityService.d.ts +5 -4
- package/dist/es/services/TransactionService.d.ts +79 -12
- package/dist/es/services/XykService.d.ts +226 -15
- 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 +114 -0
- package/dist/esm/index.js +2762 -199
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/BalanceService.d.ts +14 -13
- package/dist/esm/services/BaseService.d.ts +12 -11
- package/dist/esm/services/CovalentClient.d.ts +5 -3
- package/dist/esm/services/NftService.d.ts +18 -17
- package/dist/esm/services/PricingService.d.ts +4 -3
- package/dist/esm/services/SecurityService.d.ts +5 -4
- package/dist/esm/services/TransactionService.d.ts +79 -12
- package/dist/esm/services/XykService.d.ts +226 -15
- 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 +114 -0
- package/dist/services/BalanceService.d.ts +14 -13
- package/dist/services/BalanceService.js +16 -15
- package/dist/services/BalanceService.js.map +1 -1
- package/dist/services/BaseService.d.ts +12 -11
- package/dist/services/BaseService.js +25 -24
- package/dist/services/BaseService.js.map +1 -1
- package/dist/services/CovalentClient.d.ts +5 -3
- package/dist/services/CovalentClient.js +17 -17
- package/dist/services/CovalentClient.js.map +1 -1
- package/dist/services/NftService.d.ts +18 -17
- package/dist/services/NftService.js +30 -29
- package/dist/services/NftService.js.map +1 -1
- package/dist/services/PricingService.d.ts +4 -3
- package/dist/services/PricingService.js +4 -3
- package/dist/services/PricingService.js.map +1 -1
- package/dist/services/SecurityService.d.ts +5 -4
- package/dist/services/SecurityService.js +6 -5
- package/dist/services/SecurityService.js.map +1 -1
- package/dist/services/TransactionService.d.ts +79 -12
- package/dist/services/TransactionService.js +369 -41
- package/dist/services/TransactionService.js.map +1 -1
- package/dist/services/XykService.d.ts +226 -15
- package/dist/services/XykService.js +335 -34
- package/dist/services/XykService.js.map +1 -1
- package/dist/util/ApiHelpers.d.ts +2 -1
- package/dist/util/ApiHelpers.js +3 -3
- 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 +114 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CovalentClient.js","sourceRoot":"","sources":["../../src/services/CovalentClient.ts"],"names":[],"mappings":"AAAA,OA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1
|
+
import { Chain, Quote, Response, ChainID, Source } from "./CovalentClient";
|
|
2
2
|
import { Chains } from "../util/Chains";
|
|
3
3
|
declare class ChainCollectionResponse {
|
|
4
4
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
@@ -485,8 +485,9 @@ export declare class NftService {
|
|
|
485
485
|
private threadCount;
|
|
486
486
|
private is_key_valid;
|
|
487
487
|
private enableRetry;
|
|
488
|
+
private source;
|
|
488
489
|
private LIMIT;
|
|
489
|
-
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry
|
|
490
|
+
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry: boolean, source: Source);
|
|
490
491
|
/**
|
|
491
492
|
*
|
|
492
493
|
* Commonly used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files.
|
|
@@ -498,7 +499,7 @@ export declare class NftService {
|
|
|
498
499
|
* - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
|
|
499
500
|
*
|
|
500
501
|
*/
|
|
501
|
-
getChainCollections(chainName: Chain | Chains, queryParamOpts?: GetChainCollectionsQueryParamOpts): AsyncIterable<ChainCollectionItem>;
|
|
502
|
+
getChainCollections(chainName: Chain | Chains | ChainID, queryParamOpts?: GetChainCollectionsQueryParamOpts): AsyncIterable<ChainCollectionItem>;
|
|
502
503
|
/**
|
|
503
504
|
*
|
|
504
505
|
* Commonly used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files.
|
|
@@ -510,7 +511,7 @@ export declare class NftService {
|
|
|
510
511
|
* - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
|
|
511
512
|
*
|
|
512
513
|
*/
|
|
513
|
-
getChainCollectionsByPage(chainName: Chain | Chains, queryParamOpts?: GetChainCollectionsQueryParamOpts): Promise<Response<ChainCollectionResponse>>;
|
|
514
|
+
getChainCollectionsByPage(chainName: Chain | Chains | ChainID, queryParamOpts?: GetChainCollectionsQueryParamOpts): Promise<Response<ChainCollectionResponse>>;
|
|
514
515
|
/**
|
|
515
516
|
*
|
|
516
517
|
* Commonly used to render the NFTs (including ERC721 and ERC1155) held by an address.
|
|
@@ -523,7 +524,7 @@ export declare class NftService {
|
|
|
523
524
|
* - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side.
|
|
524
525
|
*
|
|
525
526
|
*/
|
|
526
|
-
getNftsForAddress(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetNftsForAddressQueryParamOpts): Promise<Response<NftAddressBalanceNftResponse>>;
|
|
527
|
+
getNftsForAddress(chainName: Chain | Chains | ChainID, walletAddress: string, queryParamOpts?: GetNftsForAddressQueryParamOpts): Promise<Response<NftAddressBalanceNftResponse>>;
|
|
527
528
|
/**
|
|
528
529
|
*
|
|
529
530
|
* Commonly used to get NFT token IDs with metadata from a collection. Useful for building NFT card displays.
|
|
@@ -539,7 +540,7 @@ export declare class NftService {
|
|
|
539
540
|
* - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side.
|
|
540
541
|
*
|
|
541
542
|
*/
|
|
542
|
-
getTokenIdsForContractWithMetadata(chainName: Chain | Chains, contractAddress: string, queryParamOpts?: GetTokenIdsForContractWithMetadataQueryParamOpts): AsyncIterable<NftTokenContract>;
|
|
543
|
+
getTokenIdsForContractWithMetadata(chainName: Chain | Chains | ChainID, contractAddress: string, queryParamOpts?: GetTokenIdsForContractWithMetadataQueryParamOpts): AsyncIterable<NftTokenContract>;
|
|
543
544
|
/**
|
|
544
545
|
*
|
|
545
546
|
* Commonly used to get NFT token IDs with metadata from a collection. Useful for building NFT card displays.
|
|
@@ -555,7 +556,7 @@ export declare class NftService {
|
|
|
555
556
|
* - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side.
|
|
556
557
|
*
|
|
557
558
|
*/
|
|
558
|
-
getTokenIdsForContractWithMetadataByPage(chainName: Chain | Chains, contractAddress: string, queryParamOpts?: GetTokenIdsForContractWithMetadataQueryParamOpts): Promise<Response<NftMetadataResponse>>;
|
|
559
|
+
getTokenIdsForContractWithMetadataByPage(chainName: Chain | Chains | ChainID, contractAddress: string, queryParamOpts?: GetTokenIdsForContractWithMetadataQueryParamOpts): Promise<Response<NftMetadataResponse>>;
|
|
559
560
|
/**
|
|
560
561
|
*
|
|
561
562
|
* Commonly used to get a single NFT metadata by token ID from a collection. Useful for building NFT card displays.
|
|
@@ -568,7 +569,7 @@ export declare class NftService {
|
|
|
568
569
|
* - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side.
|
|
569
570
|
*
|
|
570
571
|
*/
|
|
571
|
-
getNftMetadataForGivenTokenIdForContract(chainName: Chain | Chains, contractAddress: string, tokenId: string, queryParamOpts?: GetNftMetadataForGivenTokenIdForContractQueryParamOpts): Promise<Response<NftMetadataResponse>>;
|
|
572
|
+
getNftMetadataForGivenTokenIdForContract(chainName: Chain | Chains | ChainID, contractAddress: string, tokenId: string, queryParamOpts?: GetNftMetadataForGivenTokenIdForContractQueryParamOpts): Promise<Response<NftMetadataResponse>>;
|
|
572
573
|
/**
|
|
573
574
|
*
|
|
574
575
|
* Commonly used to get all transactions of an NFT token. Useful for building a transaction history table or price chart.
|
|
@@ -580,7 +581,7 @@ export declare class NftService {
|
|
|
580
581
|
* - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
|
|
581
582
|
*
|
|
582
583
|
*/
|
|
583
|
-
getNftTransactionsForContractTokenId(chainName: Chain | Chains, contractAddress: string, tokenId: string, queryParamOpts?: GetNftTransactionsForContractTokenIdQueryParamOpts): Promise<Response<NftTransactionsResponse>>;
|
|
584
|
+
getNftTransactionsForContractTokenId(chainName: Chain | Chains | ChainID, contractAddress: string, tokenId: string, queryParamOpts?: GetNftTransactionsForContractTokenIdQueryParamOpts): Promise<Response<NftTransactionsResponse>>;
|
|
584
585
|
/**
|
|
585
586
|
*
|
|
586
587
|
* Commonly used to fetch and render the traits of a collection as seen in rarity calculators.
|
|
@@ -589,7 +590,7 @@ export declare class NftService {
|
|
|
589
590
|
* @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
590
591
|
*
|
|
591
592
|
*/
|
|
592
|
-
getTraitsForCollection(chainName: Chain | Chains, collectionContract: string): Promise<Response<NftCollectionTraitsResponse>>;
|
|
593
|
+
getTraitsForCollection(chainName: Chain | Chains | ChainID, collectionContract: string): Promise<Response<NftCollectionTraitsResponse>>;
|
|
593
594
|
/**
|
|
594
595
|
*
|
|
595
596
|
* Commonly used to get the count of unique values for traits within an NFT collection.
|
|
@@ -599,7 +600,7 @@ export declare class NftService {
|
|
|
599
600
|
* @param {string} trait - The requested trait.
|
|
600
601
|
*
|
|
601
602
|
*/
|
|
602
|
-
getAttributesForTraitInCollection(chainName: Chain | Chains, collectionContract: string, trait: string): Promise<Response<NftCollectionAttributesForTraitResponse>>;
|
|
603
|
+
getAttributesForTraitInCollection(chainName: Chain | Chains | ChainID, collectionContract: string, trait: string): Promise<Response<NftCollectionAttributesForTraitResponse>>;
|
|
603
604
|
/**
|
|
604
605
|
*
|
|
605
606
|
* Commonly used to calculate rarity scores for a collection based on its traits.
|
|
@@ -608,7 +609,7 @@ export declare class NftService {
|
|
|
608
609
|
* @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
609
610
|
*
|
|
610
611
|
*/
|
|
611
|
-
getCollectionTraitsSummary(chainName: Chain | Chains, collectionContract: string): Promise<Response<NftCollectionTraitSummaryResponse>>;
|
|
612
|
+
getCollectionTraitsSummary(chainName: Chain | Chains | ChainID, collectionContract: string): Promise<Response<NftCollectionTraitSummaryResponse>>;
|
|
612
613
|
/**
|
|
613
614
|
*
|
|
614
615
|
* Commonly used to verify ownership of NFTs (including ERC-721 and ERC-1155) within a collection.
|
|
@@ -618,7 +619,7 @@ export declare class NftService {
|
|
|
618
619
|
* @param {string} collectionContract - The requested collection address.
|
|
619
620
|
*
|
|
620
621
|
*/
|
|
621
|
-
checkOwnershipInNft(chainName: Chain | Chains, walletAddress: string, collectionContract: string): Promise<Response<NftOwnershipForCollectionResponse>>;
|
|
622
|
+
checkOwnershipInNft(chainName: Chain | Chains | ChainID, walletAddress: string, collectionContract: string): Promise<Response<NftOwnershipForCollectionResponse>>;
|
|
622
623
|
/**
|
|
623
624
|
*
|
|
624
625
|
* Commonly used to verify ownership of a specific token (ERC-721 or ERC-1155) within a collection.
|
|
@@ -629,7 +630,7 @@ export declare class NftService {
|
|
|
629
630
|
* @param {string} tokenId - The requested token ID.
|
|
630
631
|
*
|
|
631
632
|
*/
|
|
632
|
-
checkOwnershipInNftForSpecificTokenId(chainName: Chain | Chains, walletAddress: string, collectionContract: string, tokenId: string): Promise<Response<NftOwnershipForCollectionResponse>>;
|
|
633
|
+
checkOwnershipInNftForSpecificTokenId(chainName: Chain | Chains | ChainID, walletAddress: string, collectionContract: string, tokenId: string): Promise<Response<NftOwnershipForCollectionResponse>>;
|
|
633
634
|
/**
|
|
634
635
|
*
|
|
635
636
|
* Commonly used to build a time-series chart of the sales count of an NFT collection.
|
|
@@ -641,7 +642,7 @@ export declare class NftService {
|
|
|
641
642
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
642
643
|
*
|
|
643
644
|
*/
|
|
644
|
-
getNftMarketSaleCount(chainName: Chain | Chains, contractAddress: string, queryParamOpts?: GetNftMarketSaleCountQueryParamOpts): Promise<Response<NftMarketSaleCountResponse>>;
|
|
645
|
+
getNftMarketSaleCount(chainName: Chain | Chains | ChainID, contractAddress: string, queryParamOpts?: GetNftMarketSaleCountQueryParamOpts): Promise<Response<NftMarketSaleCountResponse>>;
|
|
645
646
|
/**
|
|
646
647
|
*
|
|
647
648
|
* Commonly used to build a time-series chart of the transaction volume of an NFT collection.
|
|
@@ -653,7 +654,7 @@ export declare class NftService {
|
|
|
653
654
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
654
655
|
*
|
|
655
656
|
*/
|
|
656
|
-
getNftMarketVolume(chainName: Chain | Chains, contractAddress: string, queryParamOpts?: GetNftMarketVolumeQueryParamOpts): Promise<Response<NftMarketVolumeResponse>>;
|
|
657
|
+
getNftMarketVolume(chainName: Chain | Chains | ChainID, contractAddress: string, queryParamOpts?: GetNftMarketVolumeQueryParamOpts): Promise<Response<NftMarketVolumeResponse>>;
|
|
657
658
|
/**
|
|
658
659
|
*
|
|
659
660
|
* Commonly used to render a price floor chart for an NFT collection.
|
|
@@ -665,6 +666,6 @@ export declare class NftService {
|
|
|
665
666
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
666
667
|
*
|
|
667
668
|
*/
|
|
668
|
-
getNftMarketFloorPrice(chainName: Chain | Chains, contractAddress: string, queryParamOpts?: GetNftMarketFloorPriceQueryParamOpts): Promise<Response<NftMarketFloorPriceResponse>>;
|
|
669
|
+
getNftMarketFloorPrice(chainName: Chain | Chains | ChainID, contractAddress: string, queryParamOpts?: GetNftMarketFloorPriceQueryParamOpts): Promise<Response<NftMarketFloorPriceResponse>>;
|
|
669
670
|
}
|
|
670
671
|
export {};
|
|
@@ -326,12 +326,13 @@ class MarketFloorPriceItem {
|
|
|
326
326
|
*
|
|
327
327
|
*/
|
|
328
328
|
export class NftService {
|
|
329
|
-
constructor(apiKey, debug = false, threadCount = 3, is_key_valid, enableRetry = true) {
|
|
329
|
+
constructor(apiKey, debug = false, threadCount = 3, is_key_valid, enableRetry = true, source) {
|
|
330
330
|
this.apiKey = apiKey;
|
|
331
331
|
this.debug = debug;
|
|
332
332
|
this.threadCount = threadCount;
|
|
333
333
|
this.is_key_valid = is_key_valid;
|
|
334
334
|
this.enableRetry = enableRetry;
|
|
335
|
+
this.source = source;
|
|
335
336
|
this.LIMIT = pLimit(this.threadCount);
|
|
336
337
|
}
|
|
337
338
|
/**
|
|
@@ -363,7 +364,7 @@ export class NftService {
|
|
|
363
364
|
if (queryParamOpts?.noSpam !== undefined) {
|
|
364
365
|
urlParams.append("no-spam", queryParamOpts?.noSpam.toString());
|
|
365
366
|
}
|
|
366
|
-
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/nft/collections/`, this.apiKey, urlParams, ChainCollectionItem, this.debug, this.threadCount, this.enableRetry)) {
|
|
367
|
+
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/nft/collections/`, this.apiKey, urlParams, ChainCollectionItem, this.debug, this.threadCount, this.enableRetry, this.source)) {
|
|
367
368
|
yield res;
|
|
368
369
|
}
|
|
369
370
|
success = true;
|
|
@@ -418,13 +419,13 @@ export class NftService {
|
|
|
418
419
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/collections/?${urlParams}`, {
|
|
419
420
|
headers: {
|
|
420
421
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
421
|
-
"X-Requested-With": userAgent
|
|
422
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
422
423
|
}
|
|
423
424
|
}));
|
|
424
425
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
425
426
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
426
427
|
try {
|
|
427
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
428
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
428
429
|
}
|
|
429
430
|
catch (error) {
|
|
430
431
|
success = true;
|
|
@@ -505,13 +506,13 @@ export class NftService {
|
|
|
505
506
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_nft/?${urlParams}`, {
|
|
506
507
|
headers: {
|
|
507
508
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
508
|
-
"X-Requested-With": userAgent
|
|
509
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
509
510
|
}
|
|
510
511
|
}));
|
|
511
512
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
512
513
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
513
514
|
try {
|
|
514
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
515
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
515
516
|
}
|
|
516
517
|
catch (error) {
|
|
517
518
|
success = true;
|
|
@@ -589,7 +590,7 @@ export class NftService {
|
|
|
589
590
|
if (queryParamOpts?.withUncached !== undefined) {
|
|
590
591
|
urlParams.append("with-uncached", queryParamOpts?.withUncached.toString());
|
|
591
592
|
}
|
|
592
|
-
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/nft/${contractAddress}/metadata/`, this.apiKey, urlParams, NftTokenContract, this.debug, this.threadCount, this.enableRetry)) {
|
|
593
|
+
for await (res of paginateEndpoint(`https://api.covalenthq.com/v1/${chainName}/nft/${contractAddress}/metadata/`, this.apiKey, urlParams, NftTokenContract, this.debug, this.threadCount, this.enableRetry, this.source)) {
|
|
593
594
|
yield res;
|
|
594
595
|
}
|
|
595
596
|
success = true;
|
|
@@ -657,13 +658,13 @@ export class NftService {
|
|
|
657
658
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${contractAddress}/metadata/?${urlParams}`, {
|
|
658
659
|
headers: {
|
|
659
660
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
660
|
-
"X-Requested-With": userAgent
|
|
661
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
661
662
|
}
|
|
662
663
|
}));
|
|
663
664
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
664
665
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
665
666
|
try {
|
|
666
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
667
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
667
668
|
}
|
|
668
669
|
catch (error) {
|
|
669
670
|
success = true;
|
|
@@ -741,13 +742,13 @@ export class NftService {
|
|
|
741
742
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${contractAddress}/metadata/${tokenId}/?${urlParams}`, {
|
|
742
743
|
headers: {
|
|
743
744
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
744
|
-
"X-Requested-With": userAgent
|
|
745
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
745
746
|
}
|
|
746
747
|
}));
|
|
747
748
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
748
749
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
749
750
|
try {
|
|
750
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
751
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
751
752
|
}
|
|
752
753
|
catch (error) {
|
|
753
754
|
success = true;
|
|
@@ -821,13 +822,13 @@ export class NftService {
|
|
|
821
822
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/tokens/${contractAddress}/nft_transactions/${tokenId}/?${urlParams}`, {
|
|
822
823
|
headers: {
|
|
823
824
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
824
|
-
"X-Requested-With": userAgent
|
|
825
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
825
826
|
}
|
|
826
827
|
}));
|
|
827
828
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
828
829
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
829
830
|
try {
|
|
830
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
831
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
831
832
|
}
|
|
832
833
|
catch (error) {
|
|
833
834
|
success = true;
|
|
@@ -895,13 +896,13 @@ export class NftService {
|
|
|
895
896
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits/?${urlParams}`, {
|
|
896
897
|
headers: {
|
|
897
898
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
898
|
-
"X-Requested-With": userAgent
|
|
899
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
899
900
|
}
|
|
900
901
|
}));
|
|
901
902
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
902
903
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
903
904
|
try {
|
|
904
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
905
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
905
906
|
}
|
|
906
907
|
catch (error) {
|
|
907
908
|
success = true;
|
|
@@ -970,13 +971,13 @@ export class NftService {
|
|
|
970
971
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits/${trait}/attributes/?${urlParams}`, {
|
|
971
972
|
headers: {
|
|
972
973
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
973
|
-
"X-Requested-With": userAgent
|
|
974
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
974
975
|
}
|
|
975
976
|
}));
|
|
976
977
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
977
978
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
978
979
|
try {
|
|
979
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
980
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
980
981
|
}
|
|
981
982
|
catch (error) {
|
|
982
983
|
success = true;
|
|
@@ -1044,13 +1045,13 @@ export class NftService {
|
|
|
1044
1045
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits_summary/?${urlParams}`, {
|
|
1045
1046
|
headers: {
|
|
1046
1047
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
1047
|
-
"X-Requested-With": userAgent
|
|
1048
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
1048
1049
|
}
|
|
1049
1050
|
}));
|
|
1050
1051
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
1051
1052
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
1052
1053
|
try {
|
|
1053
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
1054
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
1054
1055
|
}
|
|
1055
1056
|
catch (error) {
|
|
1056
1057
|
success = true;
|
|
@@ -1119,13 +1120,13 @@ export class NftService {
|
|
|
1119
1120
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/collection/${collectionContract}/?${urlParams}`, {
|
|
1120
1121
|
headers: {
|
|
1121
1122
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
1122
|
-
"X-Requested-With": userAgent
|
|
1123
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
1123
1124
|
}
|
|
1124
1125
|
}));
|
|
1125
1126
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
1126
1127
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
1127
1128
|
try {
|
|
1128
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
1129
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
1129
1130
|
}
|
|
1130
1131
|
catch (error) {
|
|
1131
1132
|
success = true;
|
|
@@ -1195,13 +1196,13 @@ export class NftService {
|
|
|
1195
1196
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/collection/${collectionContract}/token/${tokenId}/?${urlParams}`, {
|
|
1196
1197
|
headers: {
|
|
1197
1198
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
1198
|
-
"X-Requested-With": userAgent
|
|
1199
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
1199
1200
|
}
|
|
1200
1201
|
}));
|
|
1201
1202
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
1202
1203
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
1203
1204
|
try {
|
|
1204
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
1205
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
1205
1206
|
}
|
|
1206
1207
|
catch (error) {
|
|
1207
1208
|
success = true;
|
|
@@ -1278,13 +1279,13 @@ export class NftService {
|
|
|
1278
1279
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/sale_count/?${urlParams}`, {
|
|
1279
1280
|
headers: {
|
|
1280
1281
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
1281
|
-
"X-Requested-With": userAgent
|
|
1282
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
1282
1283
|
}
|
|
1283
1284
|
}));
|
|
1284
1285
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
1285
1286
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
1286
1287
|
try {
|
|
1287
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
1288
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
1288
1289
|
}
|
|
1289
1290
|
catch (error) {
|
|
1290
1291
|
success = true;
|
|
@@ -1361,13 +1362,13 @@ export class NftService {
|
|
|
1361
1362
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/volume/?${urlParams}`, {
|
|
1362
1363
|
headers: {
|
|
1363
1364
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
1364
|
-
"X-Requested-With": userAgent
|
|
1365
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
1365
1366
|
}
|
|
1366
1367
|
}));
|
|
1367
1368
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
1368
1369
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
1369
1370
|
try {
|
|
1370
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
1371
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
1371
1372
|
}
|
|
1372
1373
|
catch (error) {
|
|
1373
1374
|
success = true;
|
|
@@ -1444,13 +1445,13 @@ export class NftService {
|
|
|
1444
1445
|
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/floor_price/?${urlParams}`, {
|
|
1445
1446
|
headers: {
|
|
1446
1447
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
1447
|
-
"X-Requested-With": userAgent
|
|
1448
|
+
"X-Requested-With": this.source ? this.source + " " + "(" + userAgent + ")" : userAgent
|
|
1448
1449
|
}
|
|
1449
1450
|
}));
|
|
1450
1451
|
debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
|
|
1451
1452
|
if ((this.enableRetry === true) && (!response || response.status === null || response.status === 429)) {
|
|
1452
1453
|
try {
|
|
1453
|
-
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url));
|
|
1454
|
+
data = await this.LIMIT(() => backoff.backOff(response ? response.url : url, this.source));
|
|
1454
1455
|
}
|
|
1455
1456
|
catch (error) {
|
|
1456
1457
|
success = true;
|