@covalenthq/client-sdk 2.0.3 → 2.1.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 +3 -3
- package/dist/cjs/index.d.ts +1 -6
- package/dist/cjs/index.js +1792 -674
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/services/BaseService.d.ts +1 -1
- package/dist/cjs/src/services/NftService.d.ts +1 -1
- package/dist/cjs/src/services/PricingService.d.ts +1 -1
- package/dist/cjs/src/services/TransactionService.d.ts +4 -0
- package/dist/cjs/src/utils/functions/paginateEndpoint.d.ts +4 -4
- package/dist/cjs/src/utils/types/BalanceService.types.d.ts +52 -52
- package/dist/cjs/src/utils/types/BaseService.types.d.ts +55 -55
- package/dist/cjs/src/utils/types/Generic.types.d.ts +9 -6
- package/dist/cjs/src/utils/types/NftService.types.d.ts +53 -53
- package/dist/cjs/src/utils/types/PricingService.types.d.ts +7 -7
- package/dist/cjs/src/utils/types/SecurityService.types.d.ts +15 -15
- package/dist/cjs/src/utils/types/TransactionService.types.d.ts +47 -47
- package/dist/esm/index.d.ts +1 -6
- package/dist/esm/index.js +1793 -673
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/services/BaseService.d.ts +1 -1
- package/dist/esm/src/services/NftService.d.ts +1 -1
- package/dist/esm/src/services/PricingService.d.ts +1 -1
- package/dist/esm/src/services/TransactionService.d.ts +4 -0
- package/dist/esm/src/utils/functions/paginateEndpoint.d.ts +4 -4
- package/dist/esm/src/utils/types/BalanceService.types.d.ts +52 -52
- package/dist/esm/src/utils/types/BaseService.types.d.ts +55 -55
- package/dist/esm/src/utils/types/Generic.types.d.ts +9 -6
- package/dist/esm/src/utils/types/NftService.types.d.ts +53 -53
- package/dist/esm/src/utils/types/PricingService.types.d.ts +7 -7
- package/dist/esm/src/utils/types/SecurityService.types.d.ts +15 -15
- package/dist/esm/src/utils/types/TransactionService.types.d.ts +47 -47
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ import { type Execution } from "../utils/functions/execution";
|
|
|
2
2
|
import { type AllChainsResponse, type AllChainsStatusResponse, type BlockHeightsResponse, type BlockResponse, type ChainActivityResponse, type GasPricesResponse, type GetAddressActivityQueryParamOpts, type GetBlockHeightsQueryParamOpts, type GetGasPricesQueryParamOpts, type GetLogEventsByAddressQueryParamOpts, type GetLogEventsByTopicHashQueryParamOpts, type GetLogsQueryParamOpts, type GetLogsResponse, type LogEventsByAddressResponse, type LogEventsByTopicHashResponse, type ResolvedAddress } from "../utils/types/BaseService.types";
|
|
3
3
|
import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Base API
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
export declare class BaseService {
|
|
@@ -2,7 +2,7 @@ import { type Execution } from "../utils/functions/execution";
|
|
|
2
2
|
import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types";
|
|
3
3
|
import { type ChainCollectionResponse, type CheckOwnershipInNftQueryParamOpts, type GetChainCollectionsQueryParamOpts, type GetNftMetadataForGivenTokenIdForContractQueryParamOpts, type GetNftTransactionsForContractTokenIdQueryParamOpts, type GetNftsForAddressQueryParamOpts, type GetTokenIdsForContractWithMetadataQueryParamOpts, type NftAddressBalanceNftResponse, type NftCollectionAttributesForTraitResponse, type NftCollectionTraitsResponse, type NftCollectionTraitsSummaryResponse, type NftMetadataResponse, type NftOwnershipForCollectionResponse, type NftTransactionsResponse } from "../utils/types/NftService.types";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* NFTs API
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
export declare class NftService {
|
|
@@ -2,7 +2,7 @@ import { type Execution } from "../utils/functions/execution";
|
|
|
2
2
|
import { type Chain, type GoldRushResponse, type Quote } from "../utils/types/Generic.types";
|
|
3
3
|
import { type GetTokenPricesQueryParamOpts, type TokenPricesResponse } from "../utils/types/PricingService.types";
|
|
4
4
|
/**
|
|
5
|
-
* Pricing
|
|
5
|
+
* Pricing API
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
export declare class PricingService {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type Execution } from "../utils/functions/execution";
|
|
2
2
|
import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types";
|
|
3
3
|
import { type GetAllTransactionsForAddressQueryParamOpts, type GetTimeBucketTransactionsForAddressQueryParamOpts, type GetTransactionQueryParamOpts, type GetTransactionSummaryQueryParamOpts, type GetTransactionsForAddressV3QueryParamOpts, type GetTransactionsForBlockHashByPageQueryParamOpts, type GetTransactionsForBlockHashQueryParamOpts, type GetTransactionsForBlockQueryParamOpts, type RecentTransactionsResponse, type TransactionResponse, type TransactionsBlockPageResponse, type TransactionsBlockResponse, type TransactionsResponse, type TransactionsSummaryResponse, type TransactionsTimeBucketResponse } from "../utils/types/TransactionService.types";
|
|
4
|
+
/**
|
|
5
|
+
* Transactions API
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
4
8
|
export declare class TransactionService {
|
|
5
9
|
private execution;
|
|
6
10
|
constructor(execution: Execution);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type GoldRushResponse, type Pagination, type PaginationLinks } from "../types/Generic.types";
|
|
1
|
+
import { type GoldRushResponse, type Nullable, type Pagination, type PaginationLinks } from "../types/Generic.types";
|
|
2
2
|
import { type Execution } from "./execution";
|
|
3
|
-
export declare function paginateEndpoint<T extends {
|
|
3
|
+
export declare function paginateEndpoint<T extends Nullable<{
|
|
4
4
|
pagination: Pagination;
|
|
5
|
-
} | {
|
|
5
|
+
}> | Nullable<{
|
|
6
6
|
links: PaginationLinks;
|
|
7
|
-
}>(endpoint: URL, execution: Execution, parseData: (data: GoldRushResponse<T>) => GoldRushResponse<T>, implementation: "pagination" | "links"): AsyncIterable<GoldRushResponse<T>>;
|
|
7
|
+
}> | null>(endpoint: URL, execution: Execution, parseData: (data: GoldRushResponse<T>) => GoldRushResponse<T>, implementation: "pagination" | "links"): AsyncIterable<GoldRushResponse<T>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ChainID, type ChainName, type ContractMetadata, type Explorer, type LogoUrls, type NftCollectionAttribute, type Pagination, type Quote } from "./Generic.types";
|
|
2
|
-
export
|
|
1
|
+
import { type ChainID, type ChainName, type ContractMetadata, type Explorer, type LogoUrls, type NftCollectionAttribute, type Nullable, type Pagination, type Quote } from "./Generic.types";
|
|
2
|
+
export type BalancesResponse = Nullable<{
|
|
3
3
|
/** * The requested address. */
|
|
4
4
|
address: string;
|
|
5
5
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -12,8 +12,8 @@ export interface BalancesResponse {
|
|
|
12
12
|
updated_at: Date;
|
|
13
13
|
/** * List of response items. */
|
|
14
14
|
items: BalanceItem[];
|
|
15
|
-
}
|
|
16
|
-
export
|
|
15
|
+
}>;
|
|
16
|
+
export type BalanceItem = Nullable<{
|
|
17
17
|
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
18
18
|
contract_decimals: number;
|
|
19
19
|
/** * The string returned by the `name()` method. */
|
|
@@ -58,12 +58,12 @@ export interface BalanceItem {
|
|
|
58
58
|
protocol_metadata: ProtocolMetadata;
|
|
59
59
|
/** * NFT-specific data. */
|
|
60
60
|
nft_data: BalanceNftData[];
|
|
61
|
-
}
|
|
62
|
-
export
|
|
61
|
+
}>;
|
|
62
|
+
export type ProtocolMetadata = Nullable<{
|
|
63
63
|
/** * The name of the protocol. */
|
|
64
64
|
protocol_name: string;
|
|
65
|
-
}
|
|
66
|
-
export
|
|
65
|
+
}>;
|
|
66
|
+
export type BalanceNftData = Nullable<{
|
|
67
67
|
/** * The token's id. */
|
|
68
68
|
token_id: bigint;
|
|
69
69
|
/** * The count of the number of NFTs with this ID. */
|
|
@@ -85,8 +85,8 @@ export interface BalanceNftData {
|
|
|
85
85
|
owner_address: string;
|
|
86
86
|
/** * When set to true, this NFT has been Burned. */
|
|
87
87
|
burned: boolean;
|
|
88
|
-
}
|
|
89
|
-
export
|
|
88
|
+
}>;
|
|
89
|
+
export type NftExternalDataV1 = Nullable<{
|
|
90
90
|
name: string;
|
|
91
91
|
description: string;
|
|
92
92
|
image: string;
|
|
@@ -97,8 +97,8 @@ export interface NftExternalDataV1 {
|
|
|
97
97
|
external_url: string;
|
|
98
98
|
attributes: NftCollectionAttribute[];
|
|
99
99
|
owner: string;
|
|
100
|
-
}
|
|
101
|
-
export
|
|
100
|
+
}>;
|
|
101
|
+
export type PortfolioResponse = Nullable<{
|
|
102
102
|
/** * The requested address. */
|
|
103
103
|
address: string;
|
|
104
104
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
@@ -111,8 +111,8 @@ export interface PortfolioResponse {
|
|
|
111
111
|
chain_name: ChainName;
|
|
112
112
|
/** * List of response items. */
|
|
113
113
|
items: PortfolioItem[];
|
|
114
|
-
}
|
|
115
|
-
export
|
|
114
|
+
}>;
|
|
115
|
+
export type PortfolioItem = Nullable<{
|
|
116
116
|
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
|
|
117
117
|
contract_address: string;
|
|
118
118
|
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
@@ -124,8 +124,8 @@ export interface PortfolioItem {
|
|
|
124
124
|
/** * The contract logo URL. */
|
|
125
125
|
logo_url: string;
|
|
126
126
|
holdings: HoldingItem[];
|
|
127
|
-
}
|
|
128
|
-
export
|
|
127
|
+
}>;
|
|
128
|
+
export type HoldingItem = Nullable<{
|
|
129
129
|
/** * The exchange rate for the requested quote currency. */
|
|
130
130
|
quote_rate: number;
|
|
131
131
|
timestamp: Date;
|
|
@@ -133,16 +133,16 @@ export interface HoldingItem {
|
|
|
133
133
|
high: OhlcItem;
|
|
134
134
|
low: OhlcItem;
|
|
135
135
|
open: OhlcItem;
|
|
136
|
-
}
|
|
137
|
-
export
|
|
136
|
+
}>;
|
|
137
|
+
export type OhlcItem = Nullable<{
|
|
138
138
|
/** * The asset balance. Use `contract_decimals` to scale this balance for display purposes. */
|
|
139
139
|
balance: bigint;
|
|
140
140
|
/** * The current balance converted to fiat in `quote-currency`. */
|
|
141
141
|
quote: number;
|
|
142
142
|
/** * A prettier version of the quote for rendering purposes. */
|
|
143
143
|
pretty_quote: string;
|
|
144
|
-
}
|
|
145
|
-
export
|
|
144
|
+
}>;
|
|
145
|
+
export type Erc20TransfersResponse = Nullable<{
|
|
146
146
|
/** * The requested address. */
|
|
147
147
|
address: string;
|
|
148
148
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
@@ -157,8 +157,8 @@ export interface Erc20TransfersResponse {
|
|
|
157
157
|
items: BlockTransactionWithContractTransfers[];
|
|
158
158
|
/** * Pagination metadata. */
|
|
159
159
|
pagination: Pagination;
|
|
160
|
-
}
|
|
161
|
-
export
|
|
160
|
+
}>;
|
|
161
|
+
export type BlockTransactionWithContractTransfers = Nullable<{
|
|
162
162
|
/** * The block signed timestamp in UTC. */
|
|
163
163
|
block_signed_at: Date;
|
|
164
164
|
/** * The height of the block. */
|
|
@@ -203,8 +203,8 @@ export interface BlockTransactionWithContractTransfers {
|
|
|
203
203
|
/** * The native gas exchange rate for the requested `quote-currency`. */
|
|
204
204
|
gas_quote_rate: number;
|
|
205
205
|
transfers: TokenTransferItem[];
|
|
206
|
-
}
|
|
207
|
-
export
|
|
206
|
+
}>;
|
|
207
|
+
export type TokenTransferItem = Nullable<{
|
|
208
208
|
/** * The block signed timestamp in UTC. */
|
|
209
209
|
block_signed_at: Date;
|
|
210
210
|
/** * The requested transaction hash. */
|
|
@@ -245,15 +245,15 @@ export interface TokenTransferItem {
|
|
|
245
245
|
method_calls: MethodCallsForTransfers[];
|
|
246
246
|
/** * The explorer links for this transaction. */
|
|
247
247
|
explorers: Explorer[];
|
|
248
|
-
}
|
|
249
|
-
export
|
|
248
|
+
}>;
|
|
249
|
+
export type MethodCallsForTransfers = Nullable<{
|
|
250
250
|
/** * The address of the sender. */
|
|
251
251
|
sender_address: string;
|
|
252
252
|
method: string;
|
|
253
|
-
}
|
|
254
|
-
export
|
|
253
|
+
}>;
|
|
254
|
+
export type TokenHoldersResponse = Nullable<{
|
|
255
255
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
256
|
-
updated_at: Date;
|
|
256
|
+
updated_at: Date | null;
|
|
257
257
|
/** * The requested chain ID eg: `1`. */
|
|
258
258
|
chain_id: ChainID;
|
|
259
259
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -262,8 +262,8 @@ export interface TokenHoldersResponse {
|
|
|
262
262
|
items: TokenHolder[];
|
|
263
263
|
/** * Pagination metadata. */
|
|
264
264
|
pagination: Pagination;
|
|
265
|
-
}
|
|
266
|
-
export
|
|
265
|
+
}>;
|
|
266
|
+
export type TokenHolder = Nullable<{
|
|
267
267
|
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
268
268
|
contract_decimals: number;
|
|
269
269
|
/** * The string returned by the `name()` method. */
|
|
@@ -284,8 +284,8 @@ export interface TokenHolder {
|
|
|
284
284
|
total_supply: bigint;
|
|
285
285
|
/** * The height of the block. */
|
|
286
286
|
block_height: number;
|
|
287
|
-
}
|
|
288
|
-
export
|
|
287
|
+
}>;
|
|
288
|
+
export type HistoricalBalancesResponse = Nullable<{
|
|
289
289
|
/** * The requested address. */
|
|
290
290
|
address: string;
|
|
291
291
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
@@ -298,8 +298,8 @@ export interface HistoricalBalancesResponse {
|
|
|
298
298
|
chain_name: ChainName;
|
|
299
299
|
/** * List of response items. */
|
|
300
300
|
items: HistoricalBalanceItem[];
|
|
301
|
-
}
|
|
302
|
-
export
|
|
301
|
+
}>;
|
|
302
|
+
export type HistoricalBalanceItem = Nullable<{
|
|
303
303
|
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
304
304
|
contract_decimals: number;
|
|
305
305
|
/** * The string returned by the `name()` method. */
|
|
@@ -337,8 +337,8 @@ export interface HistoricalBalanceItem {
|
|
|
337
337
|
protocol_metadata: ProtocolMetadata;
|
|
338
338
|
/** * NFT-specific data. */
|
|
339
339
|
nft_data: BalanceNftData[];
|
|
340
|
-
}
|
|
341
|
-
export
|
|
340
|
+
}>;
|
|
341
|
+
export type TokenBalanceNativeResponse = Nullable<{
|
|
342
342
|
/** * The requested address. */
|
|
343
343
|
address: string;
|
|
344
344
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
@@ -351,8 +351,8 @@ export interface TokenBalanceNativeResponse {
|
|
|
351
351
|
chain_name: ChainName;
|
|
352
352
|
/** * List of response items. */
|
|
353
353
|
items: NativeBalanceItem[];
|
|
354
|
-
}
|
|
355
|
-
export
|
|
354
|
+
}>;
|
|
355
|
+
export type NativeBalanceItem = Nullable<{
|
|
356
356
|
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
357
357
|
contract_decimals: number;
|
|
358
358
|
/** * The string returned by the `name()` method. */
|
|
@@ -375,8 +375,8 @@ export interface NativeBalanceItem {
|
|
|
375
375
|
quote: number;
|
|
376
376
|
/** * A prettier version of the quote for rendering purposes. */
|
|
377
377
|
pretty_quote: string;
|
|
378
|
-
}
|
|
379
|
-
export
|
|
378
|
+
}>;
|
|
379
|
+
export type GetTokenBalancesForWalletAddressQueryParamOpts = Nullable<{
|
|
380
380
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
381
381
|
quoteCurrency?: Quote;
|
|
382
382
|
/** * If `true`, NFTs will be included in the response. */
|
|
@@ -387,14 +387,14 @@ export interface GetTokenBalancesForWalletAddressQueryParamOpts {
|
|
|
387
387
|
noSpam?: boolean;
|
|
388
388
|
/** * 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. */
|
|
389
389
|
noNftAssetMetadata?: boolean;
|
|
390
|
-
}
|
|
391
|
-
export
|
|
390
|
+
}>;
|
|
391
|
+
export type GetHistoricalPortfolioForWalletAddressQueryParamOpts = Nullable<{
|
|
392
392
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
393
393
|
quoteCurrency?: Quote;
|
|
394
394
|
/** * The number of days to return data for. Defaults to 30 days. */
|
|
395
395
|
days?: number;
|
|
396
|
-
}
|
|
397
|
-
export
|
|
396
|
+
}>;
|
|
397
|
+
export type GetErc20TransfersForWalletAddressQueryParamOpts = Nullable<{
|
|
398
398
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
399
399
|
quoteCurrency?: Quote;
|
|
400
400
|
/** * The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. */
|
|
@@ -407,8 +407,8 @@ export interface GetErc20TransfersForWalletAddressQueryParamOpts {
|
|
|
407
407
|
pageSize?: number;
|
|
408
408
|
/** * 0-indexed page number to begin pagination. */
|
|
409
409
|
pageNumber?: number;
|
|
410
|
-
}
|
|
411
|
-
export
|
|
410
|
+
}>;
|
|
411
|
+
export type GetTokenHoldersV2ForTokenAddressQueryParamOpts = Nullable<{
|
|
412
412
|
/** * Ending block to define a block range. Omitting this parameter defaults to the latest block height. */
|
|
413
413
|
blockHeight?: number | string;
|
|
414
414
|
/** * Ending date to define a block range (YYYY-MM-DD). Omitting this parameter defaults to the current date. */
|
|
@@ -417,8 +417,8 @@ export interface GetTokenHoldersV2ForTokenAddressQueryParamOpts {
|
|
|
417
417
|
pageSize?: number;
|
|
418
418
|
/** * 0-indexed page number to begin pagination. */
|
|
419
419
|
pageNumber?: number;
|
|
420
|
-
}
|
|
421
|
-
export
|
|
420
|
+
}>;
|
|
421
|
+
export type GetHistoricalTokenBalancesForWalletAddressQueryParamOpts = Nullable<{
|
|
422
422
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
423
423
|
quoteCurrency?: Quote;
|
|
424
424
|
/** * If `true`, NFTs will be included in the response. */
|
|
@@ -433,10 +433,10 @@ export interface GetHistoricalTokenBalancesForWalletAddressQueryParamOpts {
|
|
|
433
433
|
blockHeight?: number | string;
|
|
434
434
|
/** * Ending date to define a block range (YYYY-MM-DD). Omitting this parameter defaults to the current date. */
|
|
435
435
|
date?: string;
|
|
436
|
-
}
|
|
437
|
-
export
|
|
436
|
+
}>;
|
|
437
|
+
export type GetNativeTokenBalanceQueryParamOpts = Nullable<{
|
|
438
438
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
439
439
|
quoteCurrency?: Quote;
|
|
440
440
|
/** * Ending block to define a block range. Omitting this parameter defaults to the latest block height. */
|
|
441
441
|
blockHeight?: number | string;
|
|
442
|
-
}
|
|
442
|
+
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ChainID, type ChainName, type DecodedItem, type LogEvent, type Pagination, type Quote } from "./Generic.types";
|
|
2
|
-
export
|
|
1
|
+
import { type ChainID, type ChainName, type DecodedItem, type LogEvent, type Nullable, type Pagination, type Quote } from "./Generic.types";
|
|
2
|
+
export type BlockResponse = Nullable<{
|
|
3
3
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
4
4
|
updated_at: Date;
|
|
5
5
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -8,8 +8,8 @@ export interface BlockResponse {
|
|
|
8
8
|
chain_name: ChainName;
|
|
9
9
|
/** * List of response items. */
|
|
10
10
|
items: Block[];
|
|
11
|
-
}
|
|
12
|
-
export
|
|
11
|
+
}>;
|
|
12
|
+
export type Block = Nullable<{
|
|
13
13
|
/** * The hash of the block. */
|
|
14
14
|
block_hash: string;
|
|
15
15
|
/** * The block signed timestamp in UTC. */
|
|
@@ -30,8 +30,8 @@ export interface Block {
|
|
|
30
30
|
gas_limit: number;
|
|
31
31
|
/** * The link to the related tx by block endpoint. */
|
|
32
32
|
transactions_link: string;
|
|
33
|
-
}
|
|
34
|
-
export
|
|
33
|
+
}>;
|
|
34
|
+
export type ResolvedAddress = Nullable<{
|
|
35
35
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
36
36
|
updated_at: Date;
|
|
37
37
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -40,13 +40,13 @@ export interface ResolvedAddress {
|
|
|
40
40
|
chain_name: ChainName;
|
|
41
41
|
/** * List of response items. */
|
|
42
42
|
items: ResolvedAddressItem[];
|
|
43
|
-
}
|
|
44
|
-
export
|
|
43
|
+
}>;
|
|
44
|
+
export type ResolvedAddressItem = Nullable<{
|
|
45
45
|
/** * The requested address. */
|
|
46
46
|
address: string;
|
|
47
47
|
name: string;
|
|
48
|
-
}
|
|
49
|
-
export
|
|
48
|
+
}>;
|
|
49
|
+
export type BlockHeightsResponse = Nullable<{
|
|
50
50
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
51
51
|
updated_at: Date;
|
|
52
52
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -57,8 +57,8 @@ export interface BlockHeightsResponse {
|
|
|
57
57
|
items: BlockHeights[];
|
|
58
58
|
/** * Pagination metadata. */
|
|
59
59
|
pagination: Pagination;
|
|
60
|
-
}
|
|
61
|
-
export
|
|
60
|
+
}>;
|
|
61
|
+
export type BlockHeights = Nullable<{
|
|
62
62
|
/** * The hash of the block. */
|
|
63
63
|
block_hash: string;
|
|
64
64
|
/** * The block signed timestamp in UTC. */
|
|
@@ -79,8 +79,8 @@ export interface BlockHeights {
|
|
|
79
79
|
gas_limit: number;
|
|
80
80
|
/** * The link to the related tx by block endpoint. */
|
|
81
81
|
transactions_link: string;
|
|
82
|
-
}
|
|
83
|
-
export
|
|
82
|
+
}>;
|
|
83
|
+
export type GetLogsResponse = Nullable<{
|
|
84
84
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
85
85
|
updated_at: Date;
|
|
86
86
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -89,8 +89,8 @@ export interface GetLogsResponse {
|
|
|
89
89
|
chain_name: ChainName;
|
|
90
90
|
/** * List of response items. */
|
|
91
91
|
items: GetLogsEvent[];
|
|
92
|
-
}
|
|
93
|
-
export
|
|
92
|
+
}>;
|
|
93
|
+
export type GetLogsEvent = Nullable<{
|
|
94
94
|
/** * The block signed timestamp in UTC. */
|
|
95
95
|
block_signed_at: Date;
|
|
96
96
|
/** * The height of the block. */
|
|
@@ -125,8 +125,8 @@ export interface GetLogsEvent {
|
|
|
125
125
|
raw_log_data: string;
|
|
126
126
|
/** * The decoded item. */
|
|
127
127
|
decoded: DecodedItem;
|
|
128
|
-
}
|
|
129
|
-
export
|
|
128
|
+
}>;
|
|
129
|
+
export type LogEventsByAddressResponse = Nullable<{
|
|
130
130
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
131
131
|
updated_at: Date;
|
|
132
132
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -137,8 +137,8 @@ export interface LogEventsByAddressResponse {
|
|
|
137
137
|
items: LogEvent[];
|
|
138
138
|
/** * Pagination metadata. */
|
|
139
139
|
pagination: Pagination;
|
|
140
|
-
}
|
|
141
|
-
export
|
|
140
|
+
}>;
|
|
141
|
+
export type LogEventsByTopicHashResponse = Nullable<{
|
|
142
142
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
143
143
|
updated_at: Date;
|
|
144
144
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -149,14 +149,14 @@ export interface LogEventsByTopicHashResponse {
|
|
|
149
149
|
items: LogEvent[];
|
|
150
150
|
/** * Pagination metadata. */
|
|
151
151
|
pagination: Pagination;
|
|
152
|
-
}
|
|
153
|
-
export
|
|
152
|
+
}>;
|
|
153
|
+
export type AllChainsResponse = Nullable<{
|
|
154
154
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
155
155
|
updated_at: Date;
|
|
156
156
|
/** * List of response items. */
|
|
157
157
|
items: ChainItem[];
|
|
158
|
-
}
|
|
159
|
-
export
|
|
158
|
+
}>;
|
|
159
|
+
export type ChainItem = Nullable<{
|
|
160
160
|
/** * The chain name eg: `eth-mainnet`. */
|
|
161
161
|
name: string;
|
|
162
162
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -181,8 +181,8 @@ export interface ChainItem {
|
|
|
181
181
|
is_appchain: boolean;
|
|
182
182
|
/** * The ChainItem the appchain is a part of. */
|
|
183
183
|
appchain_of: ChainItem;
|
|
184
|
-
}
|
|
185
|
-
export
|
|
184
|
+
}>;
|
|
185
|
+
export type ColorTheme = Nullable<{
|
|
186
186
|
/** * The red color code. */
|
|
187
187
|
red: number;
|
|
188
188
|
/** * The green color code. */
|
|
@@ -195,14 +195,14 @@ export interface ColorTheme {
|
|
|
195
195
|
hex: string;
|
|
196
196
|
/** * The color represented in css rgb() functional notation. */
|
|
197
197
|
css_rgb: string;
|
|
198
|
-
}
|
|
199
|
-
export
|
|
198
|
+
}>;
|
|
199
|
+
export type AllChainsStatusResponse = Nullable<{
|
|
200
200
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
201
201
|
updated_at: Date;
|
|
202
202
|
/** * List of response items. */
|
|
203
203
|
items: ChainStatusItem[];
|
|
204
|
-
}
|
|
205
|
-
export
|
|
204
|
+
}>;
|
|
205
|
+
export type ChainStatusItem = Nullable<{
|
|
206
206
|
/** * The chain name eg: `eth-mainnet`. */
|
|
207
207
|
name: string;
|
|
208
208
|
/** * The requested chain ID eg: `1`. */
|
|
@@ -217,26 +217,26 @@ export interface ChainStatusItem {
|
|
|
217
217
|
white_logo_url: string;
|
|
218
218
|
/** * True if the chain is an AppChain. */
|
|
219
219
|
is_appchain: boolean;
|
|
220
|
-
/** * The height of the
|
|
220
|
+
/** * The height of the latest block available. */
|
|
221
221
|
synced_block_height: number;
|
|
222
|
-
/** * The signed timestamp of
|
|
222
|
+
/** * The signed timestamp of latest block available. */
|
|
223
223
|
synced_blocked_signed_at: Date;
|
|
224
224
|
/** * True if the chain has data and ready for querying. */
|
|
225
225
|
has_data: boolean;
|
|
226
|
-
}
|
|
227
|
-
export
|
|
226
|
+
}>;
|
|
227
|
+
export type ChainActivityResponse = Nullable<{
|
|
228
228
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
229
229
|
updated_at: Date;
|
|
230
230
|
/** * The requested address. */
|
|
231
231
|
address: string;
|
|
232
232
|
/** * List of response items. */
|
|
233
233
|
items: ChainActivityEvent[];
|
|
234
|
-
}
|
|
235
|
-
export
|
|
234
|
+
}>;
|
|
235
|
+
export type ChainActivityEvent = Nullable<{
|
|
236
236
|
/** * The timestamp when the address was last seen on the chain. */
|
|
237
237
|
last_seen_at: Date;
|
|
238
|
-
}
|
|
239
|
-
export
|
|
238
|
+
} & ChainItem>;
|
|
239
|
+
export type GasPricesResponse = Nullable<{
|
|
240
240
|
/** * The requested chain ID eg: `1`. */
|
|
241
241
|
chain_id: ChainID;
|
|
242
242
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -253,8 +253,8 @@ export interface GasPricesResponse {
|
|
|
253
253
|
base_fee: bigint;
|
|
254
254
|
/** * List of response items. */
|
|
255
255
|
items: PriceItem[];
|
|
256
|
-
}
|
|
257
|
-
export
|
|
256
|
+
}>;
|
|
257
|
+
export type PriceItem = Nullable<{
|
|
258
258
|
/** * The average gas price, in WEI, for the time interval. */
|
|
259
259
|
gas_price: string;
|
|
260
260
|
/** * The average gas spent for the time interval. */
|
|
@@ -269,18 +269,18 @@ export interface PriceItem {
|
|
|
269
269
|
pretty_total_gas_quote: string;
|
|
270
270
|
/** * The specified time interval. */
|
|
271
271
|
interval: string;
|
|
272
|
-
}
|
|
273
|
-
export
|
|
272
|
+
}>;
|
|
273
|
+
export type OtherFees = Nullable<{
|
|
274
274
|
/** * The calculated L1 gas spent, when applicable, in quote-currency, for the specified time interval. */
|
|
275
275
|
l1_gas_quote: number;
|
|
276
|
-
}
|
|
277
|
-
export
|
|
276
|
+
}>;
|
|
277
|
+
export type GetBlockHeightsQueryParamOpts = Nullable<{
|
|
278
278
|
/** * Number of items per page. Omitting this parameter defaults to 100. */
|
|
279
279
|
pageSize?: number;
|
|
280
280
|
/** * 0-indexed page number to begin pagination. */
|
|
281
281
|
pageNumber?: number;
|
|
282
|
-
}
|
|
283
|
-
export
|
|
282
|
+
}>;
|
|
283
|
+
export type GetLogsQueryParamOpts = Nullable<{
|
|
284
284
|
/** * The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */
|
|
285
285
|
startingBlock?: number;
|
|
286
286
|
/** * The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */
|
|
@@ -293,8 +293,8 @@ export interface GetLogsQueryParamOpts {
|
|
|
293
293
|
blockHash?: string;
|
|
294
294
|
/** * Omit decoded log events. */
|
|
295
295
|
skipDecode?: boolean;
|
|
296
|
-
}
|
|
297
|
-
export
|
|
296
|
+
}>;
|
|
297
|
+
export type GetLogEventsByAddressQueryParamOpts = Nullable<{
|
|
298
298
|
/** * The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */
|
|
299
299
|
startingBlock?: string | number;
|
|
300
300
|
/** * The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */
|
|
@@ -303,8 +303,8 @@ export interface GetLogEventsByAddressQueryParamOpts {
|
|
|
303
303
|
pageSize?: number;
|
|
304
304
|
/** * 0-indexed page number to begin pagination. */
|
|
305
305
|
pageNumber?: number;
|
|
306
|
-
}
|
|
307
|
-
export
|
|
306
|
+
}>;
|
|
307
|
+
export type GetLogEventsByTopicHashQueryParamOpts = Nullable<{
|
|
308
308
|
/** * The first block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */
|
|
309
309
|
startingBlock?: string | number;
|
|
310
310
|
/** * The last block to retrieve log events with. Accepts decimals, hexadecimals, or the strings `earliest` and `latest`. */
|
|
@@ -315,12 +315,12 @@ export interface GetLogEventsByTopicHashQueryParamOpts {
|
|
|
315
315
|
pageSize?: number;
|
|
316
316
|
/** * 0-indexed page number to begin pagination. */
|
|
317
317
|
pageNumber?: number;
|
|
318
|
-
}
|
|
319
|
-
export
|
|
318
|
+
}>;
|
|
319
|
+
export type GetAddressActivityQueryParamOpts = Nullable<{
|
|
320
320
|
/** * Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. */
|
|
321
321
|
testnets?: boolean;
|
|
322
|
-
}
|
|
323
|
-
export
|
|
322
|
+
}>;
|
|
323
|
+
export type GetGasPricesQueryParamOpts = Nullable<{
|
|
324
324
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
325
325
|
quoteCurrency?: Quote;
|
|
326
|
-
}
|
|
326
|
+
}>;
|
|
@@ -353,7 +353,7 @@ export interface NftCollectionAttribute {
|
|
|
353
353
|
trait_type: string;
|
|
354
354
|
value: string;
|
|
355
355
|
}
|
|
356
|
-
export
|
|
356
|
+
export type NftData = Nullable<{
|
|
357
357
|
/** * The token's id. */
|
|
358
358
|
token_id: bigint;
|
|
359
359
|
token_url: string;
|
|
@@ -366,7 +366,7 @@ export interface NftData {
|
|
|
366
366
|
asset_cached: boolean;
|
|
367
367
|
/** * If `true`, the image data is available from the Covalent CDN. */
|
|
368
368
|
image_cached: boolean;
|
|
369
|
-
}
|
|
369
|
+
}>;
|
|
370
370
|
export interface NftExternalData {
|
|
371
371
|
name: string;
|
|
372
372
|
description: string;
|
|
@@ -394,7 +394,7 @@ export interface Param {
|
|
|
394
394
|
decoded: boolean;
|
|
395
395
|
value: string;
|
|
396
396
|
}
|
|
397
|
-
export
|
|
397
|
+
export type LogEvent = Nullable<{
|
|
398
398
|
/** * The block signed timestamp in UTC. */
|
|
399
399
|
block_signed_at: Date;
|
|
400
400
|
/** * The height of the block. */
|
|
@@ -426,7 +426,7 @@ export interface LogEvent {
|
|
|
426
426
|
raw_log_data: string;
|
|
427
427
|
/** * The decoded item. */
|
|
428
428
|
decoded: DecodedItem;
|
|
429
|
-
}
|
|
429
|
+
}>;
|
|
430
430
|
export interface ContractMetadata {
|
|
431
431
|
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
432
432
|
contract_decimals: number;
|
|
@@ -455,12 +455,12 @@ export interface LogoUrls {
|
|
|
455
455
|
/** * The chain logo URL. */
|
|
456
456
|
chain_logo_url: string;
|
|
457
457
|
}
|
|
458
|
-
export
|
|
458
|
+
export type GoldRushResponse<T> = Nullable<{
|
|
459
459
|
data: T;
|
|
460
460
|
error: boolean;
|
|
461
461
|
error_code: number | string;
|
|
462
462
|
error_message: string;
|
|
463
|
-
}
|
|
463
|
+
}>;
|
|
464
464
|
export interface GoldRushClientSettings {
|
|
465
465
|
/** * Toggle to analyze the execution of each api request. */
|
|
466
466
|
debug?: boolean;
|
|
@@ -475,3 +475,6 @@ export interface GoldRushClientSettings {
|
|
|
475
475
|
/** Set the source of the usage */
|
|
476
476
|
source?: Source | string;
|
|
477
477
|
}
|
|
478
|
+
export type Nullable<T> = {
|
|
479
|
+
[P in keyof T]: T[P] | null;
|
|
480
|
+
};
|