@covalenthq/client-sdk 2.3.8 → 3.0.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.
@@ -1,28 +1,4 @@
1
- import { type ChainID, type ChainName, type LogEvent, type NftData, type Nullable, type Pagination, type Quote } from "./Generic.types";
2
- export type ChainCollectionResponse = Nullable<{
3
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
4
- updated_at: Date;
5
- /** * The requested chain ID eg: `1`. */
6
- chain_id: ChainID;
7
- /** * The requested chain name eg: `eth-mainnet`. */
8
- chain_name: ChainName;
9
- /** * List of response items. */
10
- items: ChainCollectionItem[];
11
- /** * Pagination metadata. */
12
- pagination: Pagination;
13
- }>;
14
- export type ChainCollectionItem = Nullable<{
15
- /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
16
- contract_address: string;
17
- /** * The string returned by the `name()` method. */
18
- contract_name: string;
19
- /** * Denotes whether the token is suspected spam. Supports `eth-mainnet` and `matic-mainnet`. */
20
- is_spam: boolean;
21
- token_total_supply: number;
22
- cached_metadata_count: number;
23
- cached_asset_count: number;
24
- last_scraped_at: Date;
25
- }>;
1
+ import { type NftData, type Nullable } from "./Generic.types";
26
2
  export type NftAddressBalanceNftResponse = Nullable<{
27
3
  /** * The requested address. */
28
4
  address: string;
@@ -55,146 +31,6 @@ export type NftTokenContractBalanceItem = Nullable<{
55
31
  floor_price_native_quote: number;
56
32
  nft_data: NftData[];
57
33
  }>;
58
- export type NftMetadataResponse = Nullable<{
59
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
60
- updated_at: Date;
61
- /** * List of response items. */
62
- items: NftTokenContract[];
63
- /** * Pagination metadata. */
64
- pagination: Pagination;
65
- }>;
66
- export type NftTokenContract = Nullable<{
67
- /** * The string returned by the `name()` method. */
68
- contract_name: string;
69
- /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
70
- contract_ticker_symbol: string;
71
- /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
72
- contract_address: string;
73
- /** * Denotes whether the token is suspected spam. Supports `eth-mainnet` and `matic-mainnet`. */
74
- is_spam: boolean;
75
- type: string;
76
- nft_data: NftData;
77
- }>;
78
- export type NftTransactionsResponse = Nullable<{
79
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
80
- updated_at: Date;
81
- /** * The requested chain ID eg: `1`. */
82
- chain_id: ChainID;
83
- /** * The requested chain name eg: `eth-mainnet`. */
84
- chain_name: ChainName;
85
- /** * List of response items. */
86
- items: NftTransaction[];
87
- }>;
88
- export type NftTransaction = Nullable<{
89
- /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
90
- contract_decimals: number;
91
- /** * The string returned by the `name()` method. */
92
- contract_name: string;
93
- /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
94
- contract_ticker_symbol: string;
95
- /** * The contract logo URL. */
96
- logo_url: string;
97
- /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
98
- contract_address: string;
99
- /** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
100
- supports_erc: string[];
101
- nft_transactions: NftTransactionItem[];
102
- /** * Denotes whether the token is suspected spam. Supports `eth-mainnet` and `matic-mainnet`. */
103
- is_spam: boolean;
104
- }>;
105
- export type NftTransactionItem = Nullable<{
106
- /** * The block signed timestamp in UTC. */
107
- block_signed_at: Date;
108
- /** * The height of the block. */
109
- block_height: number;
110
- /** * The requested transaction hash. */
111
- tx_hash: string;
112
- /** * The offset is the position of the tx in the block. */
113
- tx_offset: number;
114
- /** * Whether or not transaction is successful. */
115
- successful: boolean;
116
- /** * The sender's wallet address. */
117
- from_address: string;
118
- /** * The label of `from` address. */
119
- from_address_label: string;
120
- /** * The receiver's wallet address. */
121
- to_address: string;
122
- /** * The label of `to` address. */
123
- to_address_label: string;
124
- /** * The value attached to this tx. */
125
- value: bigint;
126
- /** * The value attached in `quote-currency` to this tx. */
127
- value_quote: number;
128
- /** * A prettier version of the quote for rendering purposes. */
129
- pretty_value_quote: string;
130
- gas_offered: number;
131
- /** * The gas spent for this tx. */
132
- gas_spent: number;
133
- /** * The gas price at the time of this tx. */
134
- gas_price: number;
135
- /** * The total transaction fees (gas_price * gas_spent) paid for this tx, denoted in wei. */
136
- fees_paid: bigint;
137
- /** * The gas spent in `quote-currency` denomination. */
138
- gas_quote: number;
139
- /** * A prettier version of the quote for rendering purposes. */
140
- pretty_gas_quote: string;
141
- gas_quote_rate: number;
142
- /** * The log events. */
143
- log_events: LogEvent[];
144
- }>;
145
- export type NftCollectionTraitsResponse = Nullable<{
146
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
147
- updated_at: Date;
148
- /** * List of response items. */
149
- items: NftTrait[];
150
- }>;
151
- export type NftTrait = Nullable<{
152
- name: string;
153
- }>;
154
- export type NftCollectionAttributesForTraitResponse = Nullable<{
155
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
156
- updated_at: Date;
157
- /** * List of response items. */
158
- items: NftSummaryAttribute[];
159
- }>;
160
- export type NftSummaryAttribute = Nullable<{
161
- trait_type: string;
162
- values: NftAttribute[];
163
- unique_values: number;
164
- }>;
165
- export type NftAttribute = Nullable<{
166
- value: string;
167
- count: number;
168
- }>;
169
- export type NftCollectionTraitsSummaryResponse = Nullable<{
170
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
171
- updated_at: Date;
172
- /** * List of response items. */
173
- items: NftTraitSummary[];
174
- }>;
175
- export type NftTraitSummary = Nullable<{
176
- /** * Trait name */
177
- name: string;
178
- /** * Type of the value of the trait. */
179
- value_type: string;
180
- /** * Populated for `numeric` traits. */
181
- value_numeric: NftTraitNumeric;
182
- /** * Populated for `string` traits. */
183
- value_string: NftTraitString;
184
- attributes: NftSummaryAttribute[];
185
- }>;
186
- export type NftTraitNumeric = Nullable<{
187
- min: number;
188
- max: number;
189
- }>;
190
- export type NftTraitString = Nullable<{
191
- /** * String value */
192
- value: string;
193
- /** * Number of distinct tokens that have this trait value. */
194
- token_count: number;
195
- /** * Percentage of tokens in the collection that have this trait. */
196
- trait_percentage: number;
197
- }>;
198
34
  export type NftOwnershipForCollectionResponse = Nullable<{
199
35
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
200
36
  updated_at: Date;
@@ -225,45 +61,11 @@ export type NftOwnershipForCollectionItem = Nullable<{
225
61
  type: string;
226
62
  nft_data: NftData;
227
63
  }>;
228
- export type GetChainCollectionsQueryParamOpts = Nullable<{
229
- /** * Number of items per page. Omitting this parameter defaults to 100. */
230
- pageSize?: number;
231
- /** * 0-indexed page number to begin pagination. */
232
- pageNumber?: number;
233
- /** * If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`. */
234
- noSpam?: boolean;
235
- }>;
236
64
  export type GetNftsForAddressQueryParamOpts = Nullable<{
237
65
  /** * If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`. */
238
66
  noSpam?: boolean;
239
67
  /** * If `true`, the response shape is limited to a list of collections and token ids, omitting metadata and asset information. Helpful for faster response times and wallets holding a large number of NFTs. */
240
68
  noNftAssetMetadata?: boolean;
241
- /** * 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. */
242
- withUncached?: boolean;
243
- }>;
244
- export type GetTokenIdsForContractWithMetadataQueryParamOpts = Nullable<{
245
- /** * Omit metadata. */
246
- noMetadata?: boolean;
247
- /** * Number of items per page. Omitting this parameter defaults to 100. */
248
- pageSize?: number;
249
- /** * 0-indexed page number to begin pagination. */
250
- pageNumber?: number;
251
- /** * Filters NFTs based on a specific trait. If this filter is used, the API will return all NFTs with the specified trait. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding. */
252
- traitsFilter?: string;
253
- /** * Filters NFTs based on a specific trait value. If this filter is used, the API will return all NFTs with the specified trait value. If used with "traits-filter", only NFTs matching both filters will be returned. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding. */
254
- valuesFilter?: string;
255
- /** * 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. */
256
- withUncached?: boolean;
257
- }>;
258
- export type GetNftMetadataForGivenTokenIdForContractQueryParamOpts = Nullable<{
259
- /** * Omit metadata. */
260
- noMetadata?: boolean;
261
- /** * 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. */
262
- withUncached?: boolean;
263
- }>;
264
- export type GetNftTransactionsForContractTokenIdQueryParamOpts = Nullable<{
265
- /** * If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`. */
266
- noSpam?: boolean;
267
69
  }>;
268
70
  export type CheckOwnershipInNftQueryParamOpts = Nullable<{
269
71
  /** * Filters NFTs based on a specific trait. If this filter is used, the API will return all NFTs with the specified trait. Must be used with "values-filter", is case-sensitive, and requires proper URL encoding. */
@@ -271,85 +73,3 @@ export type CheckOwnershipInNftQueryParamOpts = Nullable<{
271
73
  /** * Filters NFTs based on a specific trait value. If this filter is used, the API will return all NFTs with the specified trait value. Must be used with "traits-filter", is case-sensitive, and requires proper URL encoding. */
272
74
  valuesFilter?: string;
273
75
  }>;
274
- export type GetCollectionMarketDataQueryParamOpts = Nullable<{
275
- /** * The requested quote currency eg: `USD`. */
276
- quote_currency?: Quote;
277
- /** The number of days to return data for. Request up 365 days. Defaults to 30 days. */
278
- days?: number;
279
- }>;
280
- export type NftCollectionFloorPriceResponse = Nullable<{
281
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
282
- updated_at: Date;
283
- /** The requested address. */
284
- address: string;
285
- /** * The requested quote currency eg: `USD`. */
286
- quote_currency: Quote;
287
- /** * The requested chain name eg: `eth-mainnet`. */
288
- chain_name: ChainName;
289
- /** * The requested chain ID eg: `1`. */
290
- chain_id: ChainID;
291
- /** * List of response items. */
292
- items: NftCollectionFloorPriceItem[];
293
- }>;
294
- export type NftCollectionFloorPriceItem = Nullable<{
295
- /** * The timestamp of the date of sale. */
296
- date: Date;
297
- /** * The ticker symbol for the native currency. */
298
- native_ticker_symbol: string;
299
- /** * The contract name of the native currency. */
300
- native_name: string;
301
- /** * The current floor price in native currency. */
302
- floor_price_native_quote: number;
303
- /** * The current floor price converted to fiat in quote-currency. */
304
- floor_price_quote: number;
305
- /** * A prettier version of the floor price quote for rendering purposes. */
306
- pretty_floor_price_quote: string;
307
- }>;
308
- export type NftCollectionVolumeResponse = Nullable<{
309
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
310
- updated_at: Date;
311
- /** The requested address. */
312
- address: string;
313
- /** * The requested quote currency eg: `USD`. */
314
- quote_currency: Quote;
315
- /** * The requested chain name eg: `eth-mainnet`. */
316
- chain_name: ChainName;
317
- /** * The requested chain ID eg: `1`. */
318
- chain_id: ChainID;
319
- /** * List of response items. */
320
- items: NftCollectionVolumeItem[];
321
- }>;
322
- export type NftCollectionVolumeItem = Nullable<{
323
- /** * The timestamp of the date of sale. */
324
- date: Date;
325
- /** * The ticker symbol for the native currency. */
326
- native_ticker_symbol: string;
327
- /** * The contract name of the native currency. */
328
- native_name: string;
329
- /** * The current volume converted to fiat in `quoteCurrency`. */
330
- volume_quote: number;
331
- /** * The current volume in native currency. */
332
- volume_native_quote: number;
333
- /** * A prettier version of the volume quote for rendering purposes. */
334
- pretty_volume_quote: string;
335
- }>;
336
- export type NftCollectionSalesCountResponse = Nullable<{
337
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
338
- updated_at: Date;
339
- /** The requested address. */
340
- address: string;
341
- /** * The requested quote currency eg: `USD`. */
342
- quote_currency: Quote;
343
- /** * The requested chain name eg: `eth-mainnet`. */
344
- chain_name: ChainName;
345
- /** * The requested chain ID eg: `1`. */
346
- chain_id: ChainID;
347
- /** * List of response items. */
348
- items: NftCollectionSalesCountItem[];
349
- }>;
350
- export type NftCollectionSalesCountItem = Nullable<{
351
- /** * The timestamp of the date of sale. */
352
- date: Date;
353
- /** * The total amount of sales for the current day. */
354
- sales_count: string;
355
- }>;
@@ -70,55 +70,3 @@ export type TokenSpenderItem = Nullable<{
70
70
  pretty_value_at_risk_quote: string;
71
71
  risk_factor: string;
72
72
  }>;
73
- export type NftApprovalsResponse = Nullable<{
74
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
75
- updated_at: Date;
76
- /** * The requested chain ID eg: `1`. */
77
- chain_id: ChainID;
78
- /** * The requested chain name eg: `eth-mainnet`. */
79
- chain_name: ChainName;
80
- /** * The requested address. */
81
- address: string;
82
- /** * List of response items. */
83
- items: NftApprovalsItem[];
84
- }>;
85
- export type NftApprovalsItem = Nullable<{
86
- /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
87
- contract_address: string;
88
- /** * The label of the contract address. */
89
- contract_address_label: string;
90
- /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
91
- contract_ticker_symbol: string;
92
- /** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
93
- supports_erc: string[];
94
- /** * List of asset balances held by the user. */
95
- token_balances: NftApprovalBalance[];
96
- /** * Contracts with non-zero approvals for this token. */
97
- spenders: NftApprovalSpender[];
98
- }>;
99
- export type NftApprovalBalance = Nullable<{
100
- /** * The token's id. */
101
- token_id: bigint;
102
- /** * The NFT's token balance. */
103
- token_balance: bigint;
104
- }>;
105
- export type NftApprovalSpender = Nullable<{
106
- /** * The height of the block. */
107
- block_height: number;
108
- /** * The offset is the position of the tx in the block. */
109
- tx_offset: number;
110
- /** * The offset is the position of the log entry within an event log." */
111
- log_offset: number;
112
- /** * The block signed timestamp in UTC. */
113
- block_signed_at: Date;
114
- /** * Most recent transaction that updated approval amounts for the token. */
115
- tx_hash: string;
116
- /** * Address of the contract with approval for the token. */
117
- spender_address: string;
118
- /** * Name of the contract with approval for the token. */
119
- spender_address_label: string;
120
- /** * The token ids approved. */
121
- token_ids_approved: string;
122
- /** * Remaining number of tokens granted to the spender by the approval. */
123
- allowance: string;
124
- }>;
@@ -314,6 +314,8 @@ export type GetTransactionSummaryQueryParamOpts = Nullable<{
314
314
  quoteCurrency?: Quote;
315
315
  /** * Include gas summary details. Additional charge of 1 credit when true. Response times may be impacted for wallets with millions of transactions. */
316
316
  withGas?: boolean;
317
+ /** * Represents the total count of ERC-20 token movement events, including `Transfer`, `Deposit` and `Withdraw`. Response times may be impacted for wallets with large number of transactions. Additional charge of 3 credits. */
318
+ withTransferCount?: boolean;
317
319
  }>;
318
320
  export type InternalTransfer = Nullable<{
319
321
  /** * The contract address sending the native token. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@covalenthq/client-sdk",
3
- "version": "2.3.8",
3
+ "version": "3.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,20 +23,13 @@
23
23
  "@rollup/plugin-commonjs": "^25.0.4",
24
24
  "@rollup/plugin-json": "^6.1.0",
25
25
  "@rollup/plugin-node-resolve": "^15.2.1",
26
- "@trivago/prettier-plugin-sort-imports": "^4.3.0",
27
26
  "@types/big.js": "^6.2.2",
28
27
  "@types/jest": "^29.5.5",
29
28
  "@types/node": "^20",
30
29
  "@types/ws": "^8.18.1",
31
- "@typescript-eslint/eslint-plugin": "^7.7.1",
32
- "@typescript-eslint/parser": "^7.7.1",
33
30
  "dotenv": "^16.4.5",
34
- "eslint": "^8",
35
- "eslint-config-prettier": "^9.1.0",
36
- "eslint-plugin-prettier": "^5.1.3",
37
31
  "jest": "^29.6.1",
38
32
  "p-limit": "^3.1.0",
39
- "prettier": "^3.3.2",
40
33
  "rimraf": "^6.0.1",
41
34
  "rollup": "^3.29.1",
42
35
  "rollup-plugin-typescript2": "^0.35.0",
@@ -68,8 +61,9 @@
68
61
  "clean": "rimraf dist",
69
62
  "start": "rollup -c",
70
63
  "lint": "eslint .",
71
- "pretty": "prettier . --write",
72
- "sync-docs": "ts-node --project s/tsconfig.json s/sync-docs/index.ts",
73
- "sync-docs:check": "ts-node --project s/tsconfig.json s/sync-docs/index.ts --check"
64
+ "format": "prettier --ignore-path ../../.prettierignore --write .",
65
+ "format:check": "prettier --ignore-path ../../.prettierignore --check .",
66
+ "sync-docs": "ts-node --project ../../s/tsconfig.json ../../s/sync-docs/index.ts",
67
+ "sync-docs:check": "ts-node --project ../../s/tsconfig.json ../../s/sync-docs/index.ts --check"
74
68
  }
75
69
  }