@covalenthq/client-sdk 0.9.5 → 0.9.7

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.
@@ -59,7 +59,7 @@ declare class BalanceItem {
59
59
  /** * The protocol metadata. */
60
60
  protocol_metadata: ProtocolMetadata;
61
61
  /** * NFT-specific data. */
62
- nft_data: NftData[];
62
+ nft_data: BalanceNftData[];
63
63
  constructor(data: BalanceItem);
64
64
  }
65
65
  declare class LogoUrls {
@@ -76,28 +76,33 @@ declare class ProtocolMetadata {
76
76
  protocol_name: string;
77
77
  constructor(data: ProtocolMetadata);
78
78
  }
79
- declare class NftData {
79
+ declare class BalanceNftData {
80
80
  /** * The token's id. */
81
81
  token_id: bigint | null;
82
+ /** * The count of the number of NFTs with this ID. */
83
+ token_balance: bigint | null;
84
+ /** * External URL for additional metadata. */
82
85
  token_url: string;
83
- /** * The original minter. */
86
+ /** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
87
+ supports_erc: string[];
88
+ /** * The latest price value on chain of the token ID. */
89
+ token_price_wei: bigint | null;
90
+ /** * The latest quote_rate of the token ID denominated in unscaled ETH. */
91
+ token_quote_rate_eth: string;
92
+ /** * The address of the original owner of this NFT. */
84
93
  original_owner: string;
85
- /** * The current holder of this NFT. */
86
- current_owner: string;
87
- external_data: NftExternalData;
88
- /** * If `true`, the asset data is available from the Covalent CDN. */
89
- asset_cached: boolean;
90
- /** * If `true`, the image data is available from the Covalent CDN. */
91
- image_cached: boolean;
92
- constructor(data: NftData);
94
+ external_data: NftExternalDataV1;
95
+ /** * The current owner of this NFT. */
96
+ owner: string;
97
+ /** * The address of the current owner of this NFT. */
98
+ owner_address: string;
99
+ /** * When set to true, this NFT has been Burned. */
100
+ burned: boolean;
101
+ constructor(data: BalanceNftData);
93
102
  }
94
- declare class NftExternalData {
103
+ declare class NftExternalDataV1 {
95
104
  name: string;
96
105
  description: string;
97
- asset_url: string;
98
- asset_file_extension: string;
99
- asset_mime_type: string;
100
- asset_size_bytes: string;
101
106
  image: string;
102
107
  image_256: string;
103
108
  image_512: string;
@@ -105,7 +110,8 @@ declare class NftExternalData {
105
110
  animation_url: string;
106
111
  external_url: string;
107
112
  attributes: NftCollectionAttribute[];
108
- constructor(data: NftExternalData);
113
+ owner: string;
114
+ constructor(data: NftExternalDataV1);
109
115
  }
110
116
  declare class NftCollectionAttribute {
111
117
  trait_type: string;
@@ -374,6 +380,7 @@ declare class HistoricalBalanceItem {
374
380
  block_height: number;
375
381
  /** * The block height when the token was last transferred. */
376
382
  last_transferred_block_height: number;
383
+ contract_display_name: string;
377
384
  /** * The timestamp when the token was transferred. */
378
385
  last_transferred_at: Date;
379
386
  /** * Indicates if a token is the chain's native gas token, eg: ETH on Ethereum. */
@@ -390,8 +397,10 @@ declare class HistoricalBalanceItem {
390
397
  quote: number;
391
398
  /** * A prettier version of the quote for rendering purposes. */
392
399
  pretty_quote: string;
400
+ /** * The protocol metadata. */
401
+ protocol_metadata: ProtocolMetadata;
393
402
  /** * NFT-specific data. */
394
- nft_data: NftData[];
403
+ nft_data: BalanceNftData[];
395
404
  constructor(data: HistoricalBalanceItem);
396
405
  }
397
406
  declare class TokenBalanceNativeResponse {
@@ -9,7 +9,7 @@ export type Chain = "btc-mainnet" | "eth-mainnet" | "matic-mainnet" | "bsc-mainn
9
9
  export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP";
10
10
  export type ChainID = 20090103 | 1 | 137 | 56 | 43114 | 10 | 250 | 1284 | 1285 | 30 | 42161 | 11297108109 | 8217 | 128 | 71402 | 2020 | 9001 | 592 | 4689 | 1666600000 | 25 | 1313161554 | 42262 | 288 | 5 | 80001 | 43113 | 97 | 1287 | 31 | 421613 | 4002 | 11297108099 | 256 | 71401 | 9000 | 4690 | 1666700000 | 1313161555 | 534354 | 534351 | 1131378225 | 53935 | 73772 | 43288 | 1294 | 56288 | 28 | 1297 | 9728 | 4328 | 1001 | 192837465 | 356256156 | 1564830818 | 278611351 | 432204 | 1026062157 | 432201 | 81 | 338 | 335 | 1088 | 588 | 2002 | 200202 | 2001 | 200101 | 73773 | 1399811149 | 2046399126 | 82 | 83 | 2139927552 | 2888 | 245022926 | 344106930 | 476158412 | 42170 | 7700 | 119 | 1029 | 14 | 114 | 19 | 16 | 321 | 322 | 1422 | 59140 | 84531 | 5001 | 534353 | 248 | 9372 | 2152 | 2154 | 416 | 23294 | 23295 | 420 | 1101 | 1662 | 1024 | 39797 | 49797 | 1663 | 11155111 | 1482601649 | 644937893 | 222000222 | 49321 | 1231 | 1230 | 7777777 | 999 | 245022934 | 2044 | 8453 | 5000 | 262018 | 59144 | 7332 | 10507 | 7979 | 1234 | 1228 | 8888 | 333000333 | 12008 | 12011 | 2038 | 1995 | 12010 | 51178 | 12009 | 12012 | 324 | 599 | 280 | 1343 | 11115 | 6765897100 | 1079 | 13337 | 16350 | 1990 | 20221 | 5611 | 12018 | 12013 | 12020 | 12015 | 12016 | 12014 | 12017 | 12019 | 431234 | 6119 | 73 | 7001 | 42888 | 919 | 5151706 | 923018 | 3441005 | 424 | 58008 | 100 | 10200 | 570 | 57000 | 167007 | 11155420 | 204 | 40 | 41 | 321123 | 360163 | 78431 | 2037 | 17772 | 152703 | 894538 | 179188 | 78432 | 7777 | 986532 | 78430 | 2195 | 11111 | 3012 | 4337 | 534352 | 17000 | 88 | 89 | 20765 | 84532 | 47279324479 | 421614 | 12027 | 12028 | 12029 | 31330 | 31331 | 31332 | 31333 | 31334 | 31335 | 412346 | 8545 | 42220 | 167008 | 336 | 999999999 | 4200 | 686868 | 1992 | 660279;
11
11
  export type Source = "Ponder" | "GoldRush" | "Viem";
12
- export declare const userAgent = "com.covalenthq.sdk.typescript/0.9.5";
12
+ export declare const userAgent = "com.covalenthq.sdk.typescript/0.9.7";
13
13
  export declare class Response<T> {
14
14
  data: T;
15
15
  error: boolean;
@@ -1,4 +1,4 @@
1
- import { NftData, Pagination, Explorer, ContractMetadata, LogoUrls } from "./GenericTypes";
1
+ import { Pagination, Explorer, ContractMetadata, LogoUrls, NftCollectionAttribute } from "./GenericTypes";
2
2
  export interface BalancesResponse {
3
3
  /** * The requested address. */
4
4
  address: string;
@@ -57,12 +57,47 @@ export interface BalanceItem {
57
57
  /** * The protocol metadata. */
58
58
  protocol_metadata: ProtocolMetadata;
59
59
  /** * NFT-specific data. */
60
- nft_data: NftData[];
60
+ nft_data: BalanceNftData[];
61
61
  }
62
62
  export interface ProtocolMetadata {
63
63
  /** * The name of the protocol. */
64
64
  protocol_name: string;
65
65
  }
66
+ export interface BalanceNftData {
67
+ /** * The token's id. */
68
+ token_id: bigint | null;
69
+ /** * The count of the number of NFTs with this ID. */
70
+ token_balance: bigint | null;
71
+ /** * External URL for additional metadata. */
72
+ token_url: string;
73
+ /** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
74
+ supports_erc: string[];
75
+ /** * The latest price value on chain of the token ID. */
76
+ token_price_wei: bigint | null;
77
+ /** * The latest quote_rate of the token ID denominated in unscaled ETH. */
78
+ token_quote_rate_eth: string;
79
+ /** * The address of the original owner of this NFT. */
80
+ original_owner: string;
81
+ external_data: NftExternalDataV1;
82
+ /** * The current owner of this NFT. */
83
+ owner: string;
84
+ /** * The address of the current owner of this NFT. */
85
+ owner_address: string;
86
+ /** * When set to true, this NFT has been Burned. */
87
+ burned: boolean;
88
+ }
89
+ export interface NftExternalDataV1 {
90
+ name: string;
91
+ description: string;
92
+ image: string;
93
+ image_256: string;
94
+ image_512: string;
95
+ image_1024: string;
96
+ animation_url: string;
97
+ external_url: string;
98
+ attributes: NftCollectionAttribute[];
99
+ owner: string;
100
+ }
66
101
  export interface PortfolioResponse {
67
102
  /** * The requested address. */
68
103
  address: string;
@@ -281,6 +316,7 @@ export interface HistoricalBalanceItem {
281
316
  block_height: number;
282
317
  /** * The block height when the token was last transferred. */
283
318
  last_transferred_block_height: number;
319
+ contract_display_name: string;
284
320
  /** * The timestamp when the token was transferred. */
285
321
  last_transferred_at: Date;
286
322
  /** * Indicates if a token is the chain's native gas token, eg: ETH on Ethereum. */
@@ -297,8 +333,10 @@ export interface HistoricalBalanceItem {
297
333
  quote: number;
298
334
  /** * A prettier version of the quote for rendering purposes. */
299
335
  pretty_quote: string;
336
+ /** * The protocol metadata. */
337
+ protocol_metadata: ProtocolMetadata;
300
338
  /** * NFT-specific data. */
301
- nft_data: NftData[];
339
+ nft_data: BalanceNftData[];
302
340
  }
303
341
  export interface TokenBalanceNativeResponse {
304
342
  /** * The requested address. */
package/dist/esm/index.js CHANGED
@@ -555,7 +555,7 @@ class BalanceItem {
555
555
  this.pretty_quote_24h = data.pretty_quote_24h;
556
556
  this.logo_urls = data.logo_urls && data.logo_urls !== null ? new LogoUrls$1(data.logo_urls) : null;
557
557
  this.protocol_metadata = data.protocol_metadata && data.protocol_metadata !== null ? new ProtocolMetadata(data.protocol_metadata) : null;
558
- this.nft_data = data.nft_data && data.nft_data !== null ? data.nft_data.map((itemData) => new NftData$1(itemData)) : null;
558
+ this.nft_data = data.nft_data && data.nft_data !== null ? data.nft_data.map((itemData) => new BalanceNftData(itemData)) : null;
559
559
  }
560
560
  }
561
561
  let LogoUrls$1 = class LogoUrls {
@@ -570,34 +570,35 @@ class ProtocolMetadata {
570
570
  this.protocol_name = data.protocol_name;
571
571
  }
572
572
  }
573
- let NftData$1 = class NftData {
573
+ class BalanceNftData {
574
574
  constructor(data) {
575
575
  this.token_id = data.token_id && data.token_id !== null ? BigInt(data.token_id) : null;
576
+ this.token_balance = data.token_balance && data.token_balance !== null ? BigInt(data.token_balance) : null;
576
577
  this.token_url = data.token_url;
578
+ this.supports_erc = data.supports_erc;
579
+ this.token_price_wei = data.token_price_wei && data.token_price_wei !== null ? BigInt(data.token_price_wei) : null;
580
+ this.token_quote_rate_eth = data.token_quote_rate_eth;
577
581
  this.original_owner = data.original_owner;
578
- this.current_owner = data.current_owner;
579
- this.asset_cached = data.asset_cached;
580
- this.image_cached = data.image_cached;
581
- this.external_data = data.external_data && data.external_data !== null ? new NftExternalData$1(data.external_data) : null;
582
+ this.owner = data.owner;
583
+ this.owner_address = data.owner_address;
584
+ this.burned = data.burned;
585
+ this.external_data = data.external_data && data.external_data !== null ? new NftExternalDataV1(data.external_data) : null;
582
586
  }
583
- };
584
- let NftExternalData$1 = class NftExternalData {
587
+ }
588
+ class NftExternalDataV1 {
585
589
  constructor(data) {
586
590
  this.name = data.name;
587
591
  this.description = data.description;
588
- this.asset_url = data.asset_url;
589
- this.asset_file_extension = data.asset_file_extension;
590
- this.asset_mime_type = data.asset_mime_type;
591
- this.asset_size_bytes = data.asset_size_bytes;
592
592
  this.image = data.image;
593
593
  this.image_256 = data.image_256;
594
594
  this.image_512 = data.image_512;
595
595
  this.image_1024 = data.image_1024;
596
596
  this.animation_url = data.animation_url;
597
597
  this.external_url = data.external_url;
598
+ this.owner = data.owner;
598
599
  this.attributes = data.attributes && data.attributes !== null ? data.attributes.map((itemData) => new NftCollectionAttribute$1(itemData)) : null;
599
600
  }
600
- };
601
+ }
601
602
  let NftCollectionAttribute$1 = class NftCollectionAttribute {
602
603
  constructor(data) {
603
604
  this.trait_type = data.trait_type;
@@ -776,6 +777,7 @@ class HistoricalBalanceItem {
776
777
  this.logo_url = data.logo_url;
777
778
  this.block_height = data.block_height;
778
779
  this.last_transferred_block_height = data.last_transferred_block_height;
780
+ this.contract_display_name = data.contract_display_name;
779
781
  this.last_transferred_at = data.last_transferred_at && data.last_transferred_at !== null ? parseISO(data.last_transferred_at.toString()) : null;
780
782
  this.native_token = data.native_token;
781
783
  this.type = data.type;
@@ -784,7 +786,8 @@ class HistoricalBalanceItem {
784
786
  this.quote_rate = data.quote_rate;
785
787
  this.quote = data.quote;
786
788
  this.pretty_quote = data.pretty_quote;
787
- this.nft_data = data.nft_data && data.nft_data !== null ? data.nft_data.map((itemData) => new NftData$1(itemData)) : null;
789
+ this.protocol_metadata = data.protocol_metadata && data.protocol_metadata !== null ? new ProtocolMetadata(data.protocol_metadata) : null;
790
+ this.nft_data = data.nft_data && data.nft_data !== null ? data.nft_data.map((itemData) => new BalanceNftData(itemData)) : null;
788
791
  }
789
792
  }
790
793
  class TokenBalanceNativeResponse {
@@ -7791,7 +7794,7 @@ class XykService {
7791
7794
  }
7792
7795
  }
7793
7796
 
7794
- const userAgent = "com.covalenthq.sdk.typescript/0.9.5";
7797
+ const userAgent = "com.covalenthq.sdk.typescript/0.9.7";
7795
7798
  class Response {
7796
7799
  }
7797
7800
  /**
@@ -7842,10 +7845,13 @@ const calculatePrettyBalance = (value, decimals = 18, roundOff = true, precision
7842
7845
  catch (error) {
7843
7846
  bigDecimalValue = new Big(value.toString());
7844
7847
  }
7845
- const _decimals = decimals || 18;
7848
+ const _decimals = decimals ?? 18;
7846
7849
  const _expoValue = BigInt(Math.pow(10, _decimals));
7847
7850
  const bigDecimalExpo = new Big(_expoValue.toString());
7848
7851
  const _calculated = bigDecimalValue.div(bigDecimalExpo);
7852
+ if (decimals === 0) {
7853
+ return _calculated.toString();
7854
+ }
7849
7855
  // removes the decimal places, true by default so it adds decimals
7850
7856
  if (!roundOff) {
7851
7857
  return _calculated.toString();