@covalenthq/client-sdk 0.7.1 → 0.7.3
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 +2 -1
- package/dist/cjs/index.js +256 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/CovalentClient.d.ts +2 -2
- package/dist/cjs/services/TransactionService.d.ts +45 -0
- package/dist/cjs/services/XykService.d.ts +1 -1
- package/dist/cjs/util/Chains.d.ts +19 -1
- package/dist/cjs/util/types/TransactionServiceTypes.d.ts +18 -0
- package/dist/cjs/util/types/XykServiceTypes.d.ts +1 -1
- package/dist/es/index.js +256 -4
- package/dist/es/index.js.map +1 -1
- package/dist/es/services/CovalentClient.d.ts +2 -2
- package/dist/es/services/TransactionService.d.ts +45 -0
- package/dist/es/services/XykService.d.ts +1 -1
- package/dist/es/util/Chains.d.ts +19 -1
- package/dist/es/util/types/TransactionServiceTypes.d.ts +18 -0
- package/dist/es/util/types/XykServiceTypes.d.ts +1 -1
- package/dist/esm/index.js +256 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/CovalentClient.d.ts +2 -2
- package/dist/esm/services/TransactionService.d.ts +45 -0
- package/dist/esm/services/XykService.d.ts +1 -1
- package/dist/esm/util/Chains.d.ts +19 -1
- package/dist/esm/util/types/TransactionServiceTypes.d.ts +18 -0
- package/dist/esm/util/types/XykServiceTypes.d.ts +1 -1
- package/dist/services/CovalentClient.d.ts +2 -2
- package/dist/services/CovalentClient.js +1 -1
- package/dist/services/TransactionService.d.ts +45 -0
- package/dist/services/TransactionService.js +236 -2
- package/dist/services/TransactionService.js.map +1 -1
- package/dist/services/XykService.d.ts +1 -1
- package/dist/services/XykService.js +1 -1
- package/dist/services/XykService.js.map +1 -1
- package/dist/util/Chains.d.ts +19 -1
- package/dist/util/Chains.js +18 -0
- package/dist/util/Chains.js.map +1 -1
- package/dist/util/types/TransactionServiceTypes.d.ts +18 -0
- package/dist/util/types/XykServiceTypes.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,9 +5,9 @@ import { NftService } from "./NftService";
|
|
|
5
5
|
import { PricingService } from "./PricingService";
|
|
6
6
|
import { TransactionService } from "./TransactionService";
|
|
7
7
|
import { XykService } from "./XykService";
|
|
8
|
-
export type Chain = "btc-mainnet" | "eth-mainnet" | "matic-mainnet" | "bsc-mainnet" | "avalanche-mainnet" | "optimism-mainnet" | "fantom-mainnet" | "moonbeam-mainnet" | "moonbeam-moonriver" | "rsk-mainnet" | "arbitrum-mainnet" | "palm-mainnet" | "klaytn-mainnet" | "heco-mainnet" | "nervos-godwoken-mainnet" | "axie-mainnet" | "evmos-mainnet" | "astar-mainnet" | "iotex-mainnet" | "harmony-mainnet" | "cronos-mainnet" | "aurora-mainnet" | "emerald-paratime-mainnet" | "boba-mainnet" | "eth-goerli" | "matic-mumbai" | "avalanche-testnet" | "bsc-testnet" | "moonbeam-moonbase-alpha" | "rsk-testnet" | "arbitrum-goerli" | "fantom-testnet" | "palm-testnet" | "heco-testnet" | "nervos-godwoken-testnet" | "evmos-testnet" | "astar-shiden" | "iotex-testnet" | "harmony-testnet" | "aurora-testnet" | "scroll-sepolia-testnet" | "covalent-internal-network-v1" | "defi-kingdoms-mainnet" | "swimmer-mainnet" | "boba-avalanche-mainnet" | "boba-bobabeam-mainnet" | "boba-bnb-mainnet" | "boba-rinkeby-testnet" | "boba-bobabase-testnet" | "boba-bnb-testnet" | "boba-avalanche-testnet" | "klaytn-testnet" | "gather-mainnet" | "gather-testnet" | "skale-calypso" | "skale-mainnet" | "skale-razor" | "avalanche-dexalot-mainnet" | "skale-omnus" | "avalanche-dexalot-testnet" | "astar-shibuya" | "cronos-testnet" | "defi-kingdoms-testnet" | "metis-mainnet" | "metis-stardust" | "milkomeda-a1-mainnet" | "milkomeda-a1-devnet" | "milkomeda-c1-mainnet" | "milkomeda-c1-devnet" | "swimmer-testnet" | "solana-mainnet" | "skale-europa" | "meter-mainnet" | "meter-testnet" | "skale-exorde" | "boba-goerli" | "neon-testnet" | "skale-staging-uum" | "skale-staging-lcc" | "arbitrum-nova-mainnet" | "canto-mainnet" | "bittorrent-mainnet" | "bittorrent-testnet" | "flarenetworks-flare-mainnet" | "flarenetworks-flare-testnet" | "flarenetworks-canary-mainnet" | "flarenetworks-canary-testnet" | "kcc-mainnet" | "kcc-testnet" | "polygon-zkevm-testnet" | "linea-testnet" | "base-testnet" | "mantle-testnet" | "scroll-alpha-testnet" | "oasys-mainnet" | "oasys-testnet" | "findora-mainnet" | "findora-forge-testnet" | "sx-mainnet" | "oasis-sapphire-mainnet" | "oasis-sapphire-testnet" | "optimism-goerli" | "polygon-zkevm-mainnet" | "horizen-yuma-testnet" | "clv-parachain" | "energi-mainnet" | "energi-testnet" | "horizen-gobi-testnet" | "eth-sepolia" | "skale-nebula" | "skale-battleground" | "avalanche-meld-testnet" | "gunzilla-testnet" | "ultron-mainnet" | "ultron-testnet" | "zora-mainnet" | "zora-testnet" | "neon-mainnet" | "avalanche-shrapnel-mainnet" | "base-mainnet" | "mantle-mainnet" | "avalanche-loco-legends-mainnet" | "linea-mainnet" | "horizen-eon-mainnet" | "avalanche-numbers" | "avalanche-dos" | "avalanche-step-network" | "avalanche-xplus" | "avalanche-xanachain" | "avalanche-meld-mainnet" | "opside-public-zkevm" | "opside-law-chain" | "avalanche-shrapnel-testnet" | "avalanche-loco-legends-testnet" | "opside-cb-zkevm" | "opside-pre-alpha-testnet" | "opside-era7" | "opside-xthrill" | "zksync-mainnet" | "metis-testnet" | "zksync-testnet" | "avalanche-blitz-testnet" | "avalanche-d-chain-testnet" | "avalanche-green-dot-testnet" | "avalanche-mintara-testnet" | "avalanche-beam-testnet" | "bnb-meta-apes-mainnet" | "bnb-antimatter-mainnet" | "bnb-antimatter-testnet" | "bnb-opbnb-testnet" | "opside-debox" | "opside-jackbot" | "opside-odx-zkevm-testnet" | "opside-readon-content-testnet" | "opside-relation" | "opside-soquest-zkevm" | "opside-vip3" | "opside-zkmeta" | "avalanche-pulsar-testnet" | "avalanche-uptn" | "bnb-fncy-mainnet" | "zetachain-testnet" | "kinto-testnet" | "mode-testnet" | "loot-mainnet" | "bnb-fncy-testnet" | "manta-testnet" | "pgn-mainnet" | "pgn-testnet" | "gnosis-mainnet" | "gnosis-testnet" | "rollux-mainnet" | "rollux-testnet" | "taiko-jolnir-testnet" | "optimism-sepolia" | "bnb-opbnb-mainnet" | "telos-mainnet" | "telos-testnet";
|
|
8
|
+
export type Chain = "btc-mainnet" | "eth-mainnet" | "matic-mainnet" | "bsc-mainnet" | "avalanche-mainnet" | "optimism-mainnet" | "fantom-mainnet" | "moonbeam-mainnet" | "moonbeam-moonriver" | "rsk-mainnet" | "arbitrum-mainnet" | "palm-mainnet" | "klaytn-mainnet" | "heco-mainnet" | "nervos-godwoken-mainnet" | "axie-mainnet" | "evmos-mainnet" | "astar-mainnet" | "iotex-mainnet" | "harmony-mainnet" | "cronos-mainnet" | "aurora-mainnet" | "emerald-paratime-mainnet" | "boba-mainnet" | "eth-goerli" | "matic-mumbai" | "avalanche-testnet" | "bsc-testnet" | "moonbeam-moonbase-alpha" | "rsk-testnet" | "arbitrum-goerli" | "fantom-testnet" | "palm-testnet" | "heco-testnet" | "nervos-godwoken-testnet" | "evmos-testnet" | "astar-shiden" | "iotex-testnet" | "harmony-testnet" | "aurora-testnet" | "scroll-l2-testnet" | "scroll-sepolia-testnet" | "covalent-internal-network-v1" | "defi-kingdoms-mainnet" | "swimmer-mainnet" | "boba-avalanche-mainnet" | "boba-bobabeam-mainnet" | "boba-bnb-mainnet" | "boba-rinkeby-testnet" | "boba-bobabase-testnet" | "boba-bnb-testnet" | "boba-avalanche-testnet" | "klaytn-testnet" | "gather-mainnet" | "gather-testnet" | "skale-calypso" | "skale-mainnet" | "skale-razor" | "avalanche-dexalot-mainnet" | "skale-omnus" | "avalanche-dexalot-testnet" | "astar-shibuya" | "cronos-testnet" | "defi-kingdoms-testnet" | "metis-mainnet" | "metis-stardust" | "milkomeda-a1-mainnet" | "milkomeda-a1-devnet" | "milkomeda-c1-mainnet" | "milkomeda-c1-devnet" | "swimmer-testnet" | "solana-mainnet" | "skale-europa" | "meter-mainnet" | "meter-testnet" | "skale-exorde" | "boba-goerli" | "neon-testnet" | "skale-staging-uum" | "skale-staging-lcc" | "arbitrum-nova-mainnet" | "canto-mainnet" | "bittorrent-mainnet" | "bittorrent-testnet" | "flarenetworks-flare-mainnet" | "flarenetworks-flare-testnet" | "flarenetworks-canary-mainnet" | "flarenetworks-canary-testnet" | "kcc-mainnet" | "kcc-testnet" | "polygon-zkevm-testnet" | "linea-testnet" | "base-testnet" | "mantle-testnet" | "scroll-alpha-testnet" | "oasys-mainnet" | "oasys-testnet" | "findora-mainnet" | "findora-forge-testnet" | "sx-mainnet" | "oasis-sapphire-mainnet" | "oasis-sapphire-testnet" | "optimism-goerli" | "polygon-zkevm-mainnet" | "horizen-yuma-testnet" | "clv-parachain" | "energi-mainnet" | "energi-testnet" | "horizen-gobi-testnet" | "eth-sepolia" | "skale-nebula" | "skale-battleground" | "avalanche-meld-testnet" | "gunzilla-testnet" | "ultron-mainnet" | "ultron-testnet" | "zora-mainnet" | "zora-testnet" | "neon-mainnet" | "avalanche-shrapnel-mainnet" | "base-mainnet" | "mantle-mainnet" | "avalanche-loco-legends-mainnet" | "linea-mainnet" | "horizen-eon-mainnet" | "avalanche-numbers" | "avalanche-dos" | "avalanche-step-network" | "avalanche-xplus" | "avalanche-xanachain" | "avalanche-meld-mainnet" | "opside-public-zkevm" | "opside-law-chain" | "avalanche-shrapnel-testnet" | "avalanche-loco-legends-testnet" | "opside-cb-zkevm" | "opside-pre-alpha-testnet" | "opside-era7" | "opside-xthrill" | "zksync-mainnet" | "metis-testnet" | "zksync-testnet" | "avalanche-blitz-testnet" | "avalanche-d-chain-testnet" | "avalanche-green-dot-testnet" | "avalanche-mintara-testnet" | "avalanche-beam-testnet" | "bnb-meta-apes-mainnet" | "bnb-antimatter-mainnet" | "bnb-antimatter-testnet" | "bnb-opbnb-testnet" | "opside-debox" | "opside-jackbot" | "opside-odx-zkevm-testnet" | "opside-readon-content-testnet" | "opside-relation" | "opside-soquest-zkevm" | "opside-vip3" | "opside-zkmeta" | "avalanche-pulsar-testnet" | "avalanche-uptn" | "bnb-fncy-mainnet" | "zetachain-testnet" | "kinto-testnet" | "mode-testnet" | "loot-mainnet" | "bnb-fncy-testnet" | "manta-testnet" | "pgn-mainnet" | "pgn-testnet" | "gnosis-mainnet" | "gnosis-testnet" | "rollux-mainnet" | "rollux-testnet" | "taiko-jolnir-testnet" | "optimism-sepolia" | "bnb-opbnb-mainnet" | "telos-mainnet" | "telos-testnet" | "avalanche-hubble-exchange-testnet" | "avalanche-miho-testnet" | "avalanche-bulletin-testnet" | "avalanche-kiwi-testnet" | "avalanche-hero-testnet" | "avalanche-avacloud-testnet" | "avalanche-thirdweb-testnet" | "avalanche-mondrian-testnet" | "avalanche-conduit-testnet" | "avalanche-nmac-testnet" | "avalanche-orderly-testnet" | "avalanche-amplify-testnet" | "avalanche-mirai-testnet" | "avalanche-wagmi-testnet" | "avalanche-playa3ull-testnet" | "avalanche-beam-mainnet" | "scroll-mainnet" | "eth-holesky";
|
|
9
9
|
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP";
|
|
10
|
-
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.
|
|
10
|
+
export declare const userAgent = "com.covalenthq.sdk.typescript/0.7.3";
|
|
11
11
|
export declare class Response<T> {
|
|
12
12
|
data: T;
|
|
13
13
|
error: boolean;
|
|
@@ -431,6 +431,31 @@ declare class TransactionsResponse {
|
|
|
431
431
|
prev(): Promise<Response<TransactionsResponse>>;
|
|
432
432
|
next(): Promise<Response<TransactionsResponse>>;
|
|
433
433
|
}
|
|
434
|
+
declare class TransactionsTimeBucketResponse {
|
|
435
|
+
private _debug;
|
|
436
|
+
private _apiKey;
|
|
437
|
+
private _threadCount;
|
|
438
|
+
private _urlParams;
|
|
439
|
+
/** * The requested address. */
|
|
440
|
+
address: string;
|
|
441
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
442
|
+
updated_at: Date;
|
|
443
|
+
/** * The requested quote currency eg: `USD`. */
|
|
444
|
+
quote_currency: string;
|
|
445
|
+
/** * The requested chain ID eg: `1`. */
|
|
446
|
+
chain_id: number;
|
|
447
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
448
|
+
chain_name: string;
|
|
449
|
+
complete: boolean;
|
|
450
|
+
/** * The current bucket of the response. */
|
|
451
|
+
current_bucket: number;
|
|
452
|
+
links: PaginationLinks;
|
|
453
|
+
/** * List of response items. */
|
|
454
|
+
items: Transaction[];
|
|
455
|
+
constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams);
|
|
456
|
+
prev(): Promise<Response<TransactionsTimeBucketResponse>>;
|
|
457
|
+
next(): Promise<Response<TransactionsTimeBucketResponse>>;
|
|
458
|
+
}
|
|
434
459
|
export interface GetTransactionQueryParamOpts {
|
|
435
460
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
436
461
|
quoteCurrency?: Quote;
|
|
@@ -473,6 +498,14 @@ export interface GetTransactionsForAddressV3QueryParamOpts {
|
|
|
473
498
|
/** * Include safe details. */
|
|
474
499
|
withSafe?: boolean;
|
|
475
500
|
}
|
|
501
|
+
export interface GetTimeBucketTransactionsForAddressQueryParamOpts {
|
|
502
|
+
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
503
|
+
quoteCurrency?: Quote;
|
|
504
|
+
/** * Omit log events. */
|
|
505
|
+
noLogs?: boolean;
|
|
506
|
+
/** * Include safe details. */
|
|
507
|
+
withSafe?: boolean;
|
|
508
|
+
}
|
|
476
509
|
export declare class TransactionService {
|
|
477
510
|
private apiKey;
|
|
478
511
|
private debug;
|
|
@@ -559,5 +592,17 @@ export declare class TransactionService {
|
|
|
559
592
|
*
|
|
560
593
|
*/
|
|
561
594
|
getTransactionsForAddressV3(chainName: Chain | Chains, walletAddress: string, page: number, queryParamOpts?: GetTransactionsForAddressV3QueryParamOpts): Promise<Response<TransactionsResponse>>;
|
|
595
|
+
/**
|
|
596
|
+
*
|
|
597
|
+
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
598
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
599
|
+
* @param {number} timeBucket - The 0-indexed 15-minute time bucket. E.g. 27 Feb 2023 05:23 GMT = 1677475383 (Unix time). 1677475383/900=1863861 timeBucket.
|
|
600
|
+
* @param {GetTimeBucketTransactionsForAddressQueryParamOpts} queryParamOpts
|
|
601
|
+
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
602
|
+
* - `noLogs`: Omit log events.
|
|
603
|
+
* - `withSafe`: Include safe details.
|
|
604
|
+
*
|
|
605
|
+
*/
|
|
606
|
+
getTimeBucketTransactionsForAddress(chainName: Chain | Chains, walletAddress: string, timeBucket: number, queryParamOpts?: GetTimeBucketTransactionsForAddressQueryParamOpts): Promise<Response<TransactionsTimeBucketResponse>>;
|
|
562
607
|
}
|
|
563
608
|
export {};
|
|
@@ -335,7 +335,7 @@ declare class TokenV2Volume {
|
|
|
335
335
|
/** * The string returned by the `name()` method. */
|
|
336
336
|
contract_name: string;
|
|
337
337
|
total_liquidity: number;
|
|
338
|
-
|
|
338
|
+
total_volume_24h: number;
|
|
339
339
|
/** * The contract logo URL. */
|
|
340
340
|
logo_url: string;
|
|
341
341
|
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
|
package/dist/es/util/Chains.d.ts
CHANGED
|
@@ -176,5 +176,23 @@ export declare enum Chains {
|
|
|
176
176
|
OPTIMISM_SEPOLIA = "optimism-sepolia",
|
|
177
177
|
BNB_OPBNB_MAINNET = "bnb-opbnb-mainnet",
|
|
178
178
|
TELOS_MAINNET = "telos-mainnet",
|
|
179
|
-
TELOS_TESTNET = "telos-testnet"
|
|
179
|
+
TELOS_TESTNET = "telos-testnet",
|
|
180
|
+
AVALANCHE_HUBBLE_EXCHANGE_TESTNET = "avalanche-hubble-exchange-testnet",
|
|
181
|
+
AVALANCHE_MIHO_TESTNET = "avalanche-miho-testnet",
|
|
182
|
+
AVALANCHE_BULLETIN_TESTNET = "avalanche-bulletin-testnet",
|
|
183
|
+
AVALANCHE_KIWI_TESTNET = "avalanche-kiwi-testnet",
|
|
184
|
+
AVALANCHE_HERO_TESTNET = "avalanche-hero-testnet",
|
|
185
|
+
AVALANCHE_AVACLOUD_TESTNET = "avalanche-avacloud-testnet",
|
|
186
|
+
AVALANCHE_THIRDWEB_TESTNET = "avalanche-thirdweb-testnet",
|
|
187
|
+
AVALANCHE_MONDRIAN_TESTNET = "avalanche-mondrian-testnet",
|
|
188
|
+
AVALANCHE_CONDUIT_TESTNET = "avalanche-conduit-testnet",
|
|
189
|
+
AVALANCHE_NMAC_TESTNET = "avalanche-nmac-testnet",
|
|
190
|
+
AVALANCHE_ORDERLY_TESTNET = "avalanche-orderly-testnet",
|
|
191
|
+
AVALANCHE_AMPLIFY_TESTNET = "avalanche-amplify-testnet",
|
|
192
|
+
AVALANCHE_MIRAI_TESTNET = "avalanche-mirai-testnet",
|
|
193
|
+
AVALANCHE_WAGMI_TESTNET = "avalanche-wagmi-testnet",
|
|
194
|
+
AVALANCHE_PLAYA3ULL_TESTNET = "avalanche-playa3ull-testnet",
|
|
195
|
+
AVALANCHE_BEAM_MAINNET = "avalanche-beam-mainnet",
|
|
196
|
+
SCROLL_MAINNET = "scroll-mainnet",
|
|
197
|
+
ETH_HOLESKY = "eth-holesky"
|
|
180
198
|
}
|
|
@@ -284,6 +284,24 @@ export interface PaginationLinks {
|
|
|
284
284
|
/** * URL link to the previous page. */
|
|
285
285
|
next: string;
|
|
286
286
|
}
|
|
287
|
+
export interface TransactionsTimeBucketResponse {
|
|
288
|
+
/** * The requested address. */
|
|
289
|
+
address: string;
|
|
290
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
291
|
+
updated_at: Date;
|
|
292
|
+
/** * The requested quote currency eg: `USD`. */
|
|
293
|
+
quote_currency: string;
|
|
294
|
+
/** * The requested chain ID eg: `1`. */
|
|
295
|
+
chain_id: number;
|
|
296
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
297
|
+
chain_name: string;
|
|
298
|
+
complete: boolean;
|
|
299
|
+
/** * The current bucket of the response. */
|
|
300
|
+
current_bucket: number;
|
|
301
|
+
links: PaginationLinks;
|
|
302
|
+
/** * List of response items. */
|
|
303
|
+
items: Transaction[];
|
|
304
|
+
}
|
|
287
305
|
export interface TransactionsBlockResponse {
|
|
288
306
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
289
307
|
updated_at: Date;
|
|
@@ -304,7 +304,7 @@ export interface TokenV2Volume {
|
|
|
304
304
|
/** * The string returned by the `name()` method. */
|
|
305
305
|
contract_name: string;
|
|
306
306
|
total_liquidity: number;
|
|
307
|
-
|
|
307
|
+
total_volume_24h: number;
|
|
308
308
|
/** * The contract logo URL. */
|
|
309
309
|
logo_url: string;
|
|
310
310
|
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
|
package/dist/esm/index.js
CHANGED
|
@@ -4787,6 +4787,155 @@ class TransactionsResponse {
|
|
|
4787
4787
|
}
|
|
4788
4788
|
}
|
|
4789
4789
|
}
|
|
4790
|
+
class TransactionsTimeBucketResponse {
|
|
4791
|
+
constructor(data, _debug, _apiKey, _threadCount, _urlParams) {
|
|
4792
|
+
this._debug = _debug;
|
|
4793
|
+
this._apiKey = _apiKey;
|
|
4794
|
+
this._threadCount = _threadCount;
|
|
4795
|
+
this._urlParams = _urlParams;
|
|
4796
|
+
this.address = data.address;
|
|
4797
|
+
this.updated_at = data.updated_at && data.updated_at !== null ? parseISO(data.updated_at.toString()) : null;
|
|
4798
|
+
this.quote_currency = data.quote_currency;
|
|
4799
|
+
this.chain_id = data.chain_id;
|
|
4800
|
+
this.chain_name = data.chain_name;
|
|
4801
|
+
this.complete = data.complete;
|
|
4802
|
+
this.current_bucket = data.current_bucket;
|
|
4803
|
+
this.links = data.links && data.links !== null ? new PaginationLinks(data.links) : null;
|
|
4804
|
+
this.items = data.items && data.items !== null ? data.items.map((itemData) => new Transaction(itemData)) : null;
|
|
4805
|
+
}
|
|
4806
|
+
async prev() {
|
|
4807
|
+
let success = false;
|
|
4808
|
+
let data;
|
|
4809
|
+
let response;
|
|
4810
|
+
const backoff = new ExponentialBackoff(this._apiKey, this._debug);
|
|
4811
|
+
const LIMIT = pLimit$1(this._threadCount);
|
|
4812
|
+
while (!success) {
|
|
4813
|
+
try {
|
|
4814
|
+
let startTime;
|
|
4815
|
+
if (this._debug) {
|
|
4816
|
+
startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
|
|
4817
|
+
}
|
|
4818
|
+
if (this.links.prev === null) {
|
|
4819
|
+
success = true;
|
|
4820
|
+
return {
|
|
4821
|
+
data: null,
|
|
4822
|
+
error: true,
|
|
4823
|
+
error_code: 400,
|
|
4824
|
+
error_message: "Invalid URL: URL link cannot be null"
|
|
4825
|
+
};
|
|
4826
|
+
}
|
|
4827
|
+
response = await LIMIT(() => fetch(`${this.links.prev}?${this._urlParams}`, {
|
|
4828
|
+
headers: {
|
|
4829
|
+
"Authorization": `Bearer ${this._apiKey}`,
|
|
4830
|
+
"X-Requested-With": userAgent
|
|
4831
|
+
}
|
|
4832
|
+
}));
|
|
4833
|
+
debugOutput(response.url, response.status ?? 429, startTime);
|
|
4834
|
+
if (response.status === null || response.status === 429) {
|
|
4835
|
+
try {
|
|
4836
|
+
data = await LIMIT(() => backoff.backOff(response.url));
|
|
4837
|
+
}
|
|
4838
|
+
catch (error) {
|
|
4839
|
+
success = true;
|
|
4840
|
+
return {
|
|
4841
|
+
data: null,
|
|
4842
|
+
error: true,
|
|
4843
|
+
error_code: response.status ?? 429,
|
|
4844
|
+
error_message: error.message
|
|
4845
|
+
};
|
|
4846
|
+
}
|
|
4847
|
+
}
|
|
4848
|
+
else {
|
|
4849
|
+
data = await response.json();
|
|
4850
|
+
}
|
|
4851
|
+
const dataClass = new TransactionsTimeBucketResponse(data.data, this._debug, this._apiKey, this._threadCount, this._urlParams);
|
|
4852
|
+
checkAndModifyResponse(dataClass);
|
|
4853
|
+
success = true;
|
|
4854
|
+
return {
|
|
4855
|
+
data: dataClass,
|
|
4856
|
+
error: data.error,
|
|
4857
|
+
error_code: data ? data.error_code : response.status,
|
|
4858
|
+
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required"
|
|
4859
|
+
};
|
|
4860
|
+
}
|
|
4861
|
+
catch (error) {
|
|
4862
|
+
success = true;
|
|
4863
|
+
return {
|
|
4864
|
+
data: null,
|
|
4865
|
+
error: true,
|
|
4866
|
+
error_code: data ? data.error_code : response.status,
|
|
4867
|
+
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required"
|
|
4868
|
+
};
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
}
|
|
4872
|
+
async next() {
|
|
4873
|
+
let success = false;
|
|
4874
|
+
let data;
|
|
4875
|
+
let response;
|
|
4876
|
+
const backoff = new ExponentialBackoff(this._apiKey, this._debug);
|
|
4877
|
+
const LIMIT = pLimit$1(this._threadCount);
|
|
4878
|
+
while (!success) {
|
|
4879
|
+
try {
|
|
4880
|
+
let startTime;
|
|
4881
|
+
if (this._debug) {
|
|
4882
|
+
startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
|
|
4883
|
+
}
|
|
4884
|
+
if (this.links.next === null) {
|
|
4885
|
+
success = true;
|
|
4886
|
+
return {
|
|
4887
|
+
data: null,
|
|
4888
|
+
error: true,
|
|
4889
|
+
error_code: 400,
|
|
4890
|
+
error_message: "Invalid URL: URL link cannot be null"
|
|
4891
|
+
};
|
|
4892
|
+
}
|
|
4893
|
+
response = await LIMIT(() => fetch(`${this.links.next}?${this._urlParams}`, {
|
|
4894
|
+
headers: {
|
|
4895
|
+
"Authorization": `Bearer ${this._apiKey}`,
|
|
4896
|
+
"X-Requested-With": userAgent
|
|
4897
|
+
}
|
|
4898
|
+
}));
|
|
4899
|
+
debugOutput(response.url, response.status ?? 429, startTime);
|
|
4900
|
+
if (response.status === null || response.status === 429) {
|
|
4901
|
+
try {
|
|
4902
|
+
data = await LIMIT(() => backoff.backOff(response.url));
|
|
4903
|
+
}
|
|
4904
|
+
catch (error) {
|
|
4905
|
+
success = true;
|
|
4906
|
+
return {
|
|
4907
|
+
data: null,
|
|
4908
|
+
error: true,
|
|
4909
|
+
error_code: response.status ?? 429,
|
|
4910
|
+
error_message: error.message
|
|
4911
|
+
};
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
else {
|
|
4915
|
+
data = await response.json();
|
|
4916
|
+
}
|
|
4917
|
+
const dataClass = new TransactionsTimeBucketResponse(data.data, this._debug, this._apiKey, this._threadCount, this._urlParams);
|
|
4918
|
+
checkAndModifyResponse(dataClass);
|
|
4919
|
+
success = true;
|
|
4920
|
+
return {
|
|
4921
|
+
data: dataClass,
|
|
4922
|
+
error: data.error,
|
|
4923
|
+
error_code: data ? data.error_code : response.status,
|
|
4924
|
+
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required"
|
|
4925
|
+
};
|
|
4926
|
+
}
|
|
4927
|
+
catch (error) {
|
|
4928
|
+
success = true;
|
|
4929
|
+
return {
|
|
4930
|
+
data: null,
|
|
4931
|
+
error: true,
|
|
4932
|
+
error_code: data ? data.error_code : response.status,
|
|
4933
|
+
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required"
|
|
4934
|
+
};
|
|
4935
|
+
}
|
|
4936
|
+
}
|
|
4937
|
+
}
|
|
4938
|
+
}
|
|
4790
4939
|
/**
|
|
4791
4940
|
* Transactions APIs
|
|
4792
4941
|
*
|
|
@@ -5291,12 +5440,12 @@ class TransactionService {
|
|
|
5291
5440
|
if (this.debug) {
|
|
5292
5441
|
startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
|
|
5293
5442
|
}
|
|
5294
|
-
response = await fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transactions_v3/page/${page}/?${urlParams}`, {
|
|
5443
|
+
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transactions_v3/page/${page}/?${urlParams}`, {
|
|
5295
5444
|
headers: {
|
|
5296
5445
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
5297
5446
|
"X-Requested-With": userAgent
|
|
5298
5447
|
}
|
|
5299
|
-
});
|
|
5448
|
+
}));
|
|
5300
5449
|
debugOutput(response.url, response.status ?? 429, startTime);
|
|
5301
5450
|
if (response.status === null || response.status === 429) {
|
|
5302
5451
|
try {
|
|
@@ -5336,6 +5485,91 @@ class TransactionService {
|
|
|
5336
5485
|
}
|
|
5337
5486
|
}
|
|
5338
5487
|
}
|
|
5488
|
+
/**
|
|
5489
|
+
*
|
|
5490
|
+
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
5491
|
+
* @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
5492
|
+
* @param {number} timeBucket - The 0-indexed 15-minute time bucket. E.g. 27 Feb 2023 05:23 GMT = 1677475383 (Unix time). 1677475383/900=1863861 timeBucket.
|
|
5493
|
+
* @param {GetTimeBucketTransactionsForAddressQueryParamOpts} queryParamOpts
|
|
5494
|
+
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
5495
|
+
* - `noLogs`: Omit log events.
|
|
5496
|
+
* - `withSafe`: Include safe details.
|
|
5497
|
+
*
|
|
5498
|
+
*/
|
|
5499
|
+
async getTimeBucketTransactionsForAddress(chainName, walletAddress, timeBucket, queryParamOpts) {
|
|
5500
|
+
let success = false;
|
|
5501
|
+
let data;
|
|
5502
|
+
let response;
|
|
5503
|
+
const backoff = new ExponentialBackoff(this.apiKey, this.debug);
|
|
5504
|
+
while (!success) {
|
|
5505
|
+
try {
|
|
5506
|
+
const urlParams = new URLSearchParams();
|
|
5507
|
+
if (!this.is_key_valid) {
|
|
5508
|
+
return {
|
|
5509
|
+
data: null,
|
|
5510
|
+
error: true,
|
|
5511
|
+
error_code: 401,
|
|
5512
|
+
error_message: ApiKeyValidator.INVALID_API_KEY_MESSAGE
|
|
5513
|
+
};
|
|
5514
|
+
}
|
|
5515
|
+
if (queryParamOpts?.quoteCurrency !== undefined) {
|
|
5516
|
+
urlParams.append("quote-currency", queryParamOpts?.quoteCurrency.toString());
|
|
5517
|
+
}
|
|
5518
|
+
if (queryParamOpts?.noLogs !== undefined) {
|
|
5519
|
+
urlParams.append("no-logs", queryParamOpts?.noLogs.toString());
|
|
5520
|
+
}
|
|
5521
|
+
if (queryParamOpts?.withSafe !== undefined) {
|
|
5522
|
+
urlParams.append("with-safe", queryParamOpts?.withSafe.toString());
|
|
5523
|
+
}
|
|
5524
|
+
let startTime;
|
|
5525
|
+
if (this.debug) {
|
|
5526
|
+
startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
|
|
5527
|
+
}
|
|
5528
|
+
response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/bulk/transactions/${walletAddress}/${timeBucket}/?${urlParams}`, {
|
|
5529
|
+
headers: {
|
|
5530
|
+
"Authorization": `Bearer ${this.apiKey}`,
|
|
5531
|
+
"X-Requested-With": userAgent
|
|
5532
|
+
}
|
|
5533
|
+
}));
|
|
5534
|
+
debugOutput(response.url, response.status ?? 429, startTime);
|
|
5535
|
+
if (response.status === null || response.status === 429) {
|
|
5536
|
+
try {
|
|
5537
|
+
data = await this.LIMIT(() => backoff.backOff(response.url));
|
|
5538
|
+
}
|
|
5539
|
+
catch (error) {
|
|
5540
|
+
success = true;
|
|
5541
|
+
return {
|
|
5542
|
+
data: null,
|
|
5543
|
+
error: true,
|
|
5544
|
+
error_code: response.status ?? 429,
|
|
5545
|
+
error_message: error.message
|
|
5546
|
+
};
|
|
5547
|
+
}
|
|
5548
|
+
}
|
|
5549
|
+
else {
|
|
5550
|
+
data = await response.json();
|
|
5551
|
+
}
|
|
5552
|
+
const dataClass = new TransactionsTimeBucketResponse(data.data, this.debug, this.apiKey, this.threadCount, urlParams);
|
|
5553
|
+
checkAndModifyResponse(dataClass);
|
|
5554
|
+
success = true;
|
|
5555
|
+
return {
|
|
5556
|
+
data: dataClass,
|
|
5557
|
+
error: data.error,
|
|
5558
|
+
error_code: data ? data.error_code : response.status,
|
|
5559
|
+
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required"
|
|
5560
|
+
};
|
|
5561
|
+
}
|
|
5562
|
+
catch (error) {
|
|
5563
|
+
success = true;
|
|
5564
|
+
return {
|
|
5565
|
+
data: null,
|
|
5566
|
+
error: true,
|
|
5567
|
+
error_code: data ? data.error_code : response.status,
|
|
5568
|
+
error_message: data ? data.error_message : response.status === 500 ? "Internal server error" : "401 Authorization Required"
|
|
5569
|
+
};
|
|
5570
|
+
}
|
|
5571
|
+
}
|
|
5572
|
+
}
|
|
5339
5573
|
}
|
|
5340
5574
|
|
|
5341
5575
|
class PoolResponse {
|
|
@@ -5587,7 +5821,7 @@ class TokenV2Volume {
|
|
|
5587
5821
|
this.contract_address = data.contract_address;
|
|
5588
5822
|
this.contract_name = data.contract_name;
|
|
5589
5823
|
this.total_liquidity = data.total_liquidity;
|
|
5590
|
-
this.
|
|
5824
|
+
this.total_volume_24h = data.total_volume_24h;
|
|
5591
5825
|
this.logo_url = data.logo_url;
|
|
5592
5826
|
this.contract_ticker_symbol = data.contract_ticker_symbol;
|
|
5593
5827
|
this.contract_decimals = data.contract_decimals;
|
|
@@ -6793,7 +7027,7 @@ class XykService {
|
|
|
6793
7027
|
}
|
|
6794
7028
|
}
|
|
6795
7029
|
|
|
6796
|
-
const userAgent = "com.covalenthq.sdk.typescript/0.7.
|
|
7030
|
+
const userAgent = "com.covalenthq.sdk.typescript/0.7.3";
|
|
6797
7031
|
/**
|
|
6798
7032
|
* CovalentClient Class
|
|
6799
7033
|
*/
|
|
@@ -7109,6 +7343,24 @@ var Chains;
|
|
|
7109
7343
|
Chains["BNB_OPBNB_MAINNET"] = "bnb-opbnb-mainnet";
|
|
7110
7344
|
Chains["TELOS_MAINNET"] = "telos-mainnet";
|
|
7111
7345
|
Chains["TELOS_TESTNET"] = "telos-testnet";
|
|
7346
|
+
Chains["AVALANCHE_HUBBLE_EXCHANGE_TESTNET"] = "avalanche-hubble-exchange-testnet";
|
|
7347
|
+
Chains["AVALANCHE_MIHO_TESTNET"] = "avalanche-miho-testnet";
|
|
7348
|
+
Chains["AVALANCHE_BULLETIN_TESTNET"] = "avalanche-bulletin-testnet";
|
|
7349
|
+
Chains["AVALANCHE_KIWI_TESTNET"] = "avalanche-kiwi-testnet";
|
|
7350
|
+
Chains["AVALANCHE_HERO_TESTNET"] = "avalanche-hero-testnet";
|
|
7351
|
+
Chains["AVALANCHE_AVACLOUD_TESTNET"] = "avalanche-avacloud-testnet";
|
|
7352
|
+
Chains["AVALANCHE_THIRDWEB_TESTNET"] = "avalanche-thirdweb-testnet";
|
|
7353
|
+
Chains["AVALANCHE_MONDRIAN_TESTNET"] = "avalanche-mondrian-testnet";
|
|
7354
|
+
Chains["AVALANCHE_CONDUIT_TESTNET"] = "avalanche-conduit-testnet";
|
|
7355
|
+
Chains["AVALANCHE_NMAC_TESTNET"] = "avalanche-nmac-testnet";
|
|
7356
|
+
Chains["AVALANCHE_ORDERLY_TESTNET"] = "avalanche-orderly-testnet";
|
|
7357
|
+
Chains["AVALANCHE_AMPLIFY_TESTNET"] = "avalanche-amplify-testnet";
|
|
7358
|
+
Chains["AVALANCHE_MIRAI_TESTNET"] = "avalanche-mirai-testnet";
|
|
7359
|
+
Chains["AVALANCHE_WAGMI_TESTNET"] = "avalanche-wagmi-testnet";
|
|
7360
|
+
Chains["AVALANCHE_PLAYA3ULL_TESTNET"] = "avalanche-playa3ull-testnet";
|
|
7361
|
+
Chains["AVALANCHE_BEAM_MAINNET"] = "avalanche-beam-mainnet";
|
|
7362
|
+
Chains["SCROLL_MAINNET"] = "scroll-mainnet";
|
|
7363
|
+
Chains["ETH_HOLESKY"] = "eth-holesky";
|
|
7112
7364
|
})(Chains || (Chains = {}));
|
|
7113
7365
|
|
|
7114
7366
|
export { Chains, Client, CovalentClient, calculatePrettyBalance, prettifyCurrency };
|