@covalenthq/client-sdk
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -7,4 +7,6 @@ export { GoldRushClient } from "./src/GoldRushClient"; | ||
export { timestampParser } from "./src/utils/functions/timestamp-parser"; | ||
export * from "./src/utils/types/AllChainService.types"; | ||
export * from "./src/utils/types/BalanceService.types"; | ||
export * from "./src/utils/types/BaseService.types"; | ||
export * from "./src/utils/types/BitcoinService.types"; | ||
export * from "./src/utils/types/Generic.types"; | ||
@@ -11,0 +13,0 @@ export * from "./src/utils/types/NftService.types"; |
import { AllChainsService } from "./services/AllChainsService"; | ||
import { BalanceService } from "./services/BalanceService"; | ||
import { BaseService } from "./services/BaseService"; | ||
import { BitcoinService } from "./services/BitcoinService"; | ||
import { NftService } from "./services/NftService"; | ||
@@ -17,2 +18,3 @@ import { PricingService } from "./services/PricingService"; | ||
BaseService: BaseService; | ||
BitcoinService: BitcoinService; | ||
NftService: NftService; | ||
@@ -19,0 +21,0 @@ PricingService: PricingService; |
import { type Execution } from "../utils/functions/execution"; | ||
import { type GetMultiChainAndMultiAddressTransactionsParamOtps, type MultiChainMultiAddressTransactionsResponse } from "../utils/types/AllChainService.types"; | ||
import { type ChainActivityResponse, type GetAddressActivityQueryParamOpts, type GetMultiChainBalanceQueryParamOpts, type GetMultiChainMultiAddressTransactionsParamOtps, type MultiChainBalanceResponse, type MultiChainMultiAddressTransactionsResponse } from "../utils/types/AllChainService.types"; | ||
import { type GoldRushResponse } from "../utils/types/Generic.types"; | ||
@@ -13,2 +13,12 @@ /** | ||
* | ||
* Commonly used to locate chains which an address is active on with a single API call. | ||
* | ||
* @param {string} walletAddress - The requested wallet address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. | ||
* @param {GetAddressActivityQueryParamOpts} queryParamOpts | ||
* - `testnets`: Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. | ||
* | ||
*/ | ||
getAddressActivity(walletAddress: string, queryParamOpts?: GetAddressActivityQueryParamOpts): Promise<GoldRushResponse<ChainActivityResponse>>; | ||
/** | ||
* | ||
* Commonly used to get transactions cross chains and addresses. | ||
@@ -23,6 +33,33 @@ * | ||
* @param {boolean} withDecodedLogs - Whether to include decoded logs in the response. | ||
* @param {Quote | "BTC" | "ETH"} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, "BTC" and "ETH". | ||
* @param {Quote | CryptocurrencyQuote} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `BTC` and `ETH`. | ||
* | ||
*/ | ||
getMultiChainAndMultiAddressTransactions(queryParamOpts?: GetMultiChainAndMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>; | ||
getMultiChainMultiAddressTransactions(queryParamOpts?: GetMultiChainMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>; | ||
/** | ||
* @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getMultiChainMultiAddressTransactions` instead. | ||
* | ||
* Commonly used to get transactions cross chains and addresses. | ||
* | ||
* @param {Chain[]} chains - An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains. | ||
* @param {string[]} addresses - An array of addresses for which transactions are fetched. Does not support name resolution. | ||
* @param {number} limit - Number of transactions to return per page, up to the default max of 100 items. | ||
* @param {string} before - Pagination cursor pointing to fetch transactions before a certain point. | ||
* @param {string} after - Pagination cursor pointing to fetch transactions after a certain point. | ||
* @param {boolean} withLogs - Whether to include raw logs in the response. | ||
* @param {boolean} withDecodedLogs - Whether to include decoded logs in the response. | ||
* @param {Quote | CryptocurrencyQuote} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `BTC` and `ETH`. | ||
* | ||
*/ | ||
getMultiChainAndMultiAddressTransactions(queryParamOpts?: GetMultiChainMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>; | ||
/** | ||
* | ||
* @param {string} walletAddress - The requested wallet Address. | ||
* @param {GetMultiChainBalanceQueryParamOpts} queryParamOpts | ||
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `BTC`, and `ETH`. | ||
* - `chains`: Array chain ids or chain names to query. Limited to 10 chains. | ||
* - `limit`: The number of items to return. Default is 100. | ||
* - `timestamp`: The timestamp to query balances at. If omitted, the latest balances are returned. | ||
* - `cursorBefore`: The cursor of previous page. | ||
*/ | ||
getMultiChainBalances(walletAddress: string, queryParamOpts?: GetMultiChainBalanceQueryParamOpts): Promise<GoldRushResponse<MultiChainBalanceResponse>>; | ||
} |
import { type Execution } from "../utils/functions/execution"; | ||
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"; | ||
import { type ChainActivityResponse, type GetAddressActivityQueryParamOpts } from "../utils/types/AllChainService.types"; | ||
import { type AllChainsResponse, type AllChainsStatusResponse, type BlockHeightsResponse, type BlockResponse, type GasPricesResponse, type GetBlockHeightsQueryParamOpts, type GetGasPricesQueryParamOpts, type GetLogEventsByAddressQueryParamOpts, type GetLogEventsByTopicHashQueryParamOpts, type GetLogsQueryParamOpts, type GetLogsResponse, type LogEventsByAddressResponse, type LogEventsByTopicHashResponse, type ResolvedAddress } from "../utils/types/BaseService.types"; | ||
import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types"; | ||
@@ -143,2 +144,3 @@ /** | ||
/** | ||
* @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getAddressActivity` instead. | ||
* | ||
@@ -145,0 +147,0 @@ * Commonly used to locate chains which an address is active on with a single API call. |
@@ -1,3 +0,20 @@ | ||
import { type Chain, type ChainID, type ChainName, type Nullable, type Quote } from "./Generic.types"; | ||
import { type ChainItem } from "./BaseService.types"; | ||
import { type Chain, type ChainID, type ChainName, type CryptocurrencyQuote, type LogoUrls, type Nullable, type Quote } from "./Generic.types"; | ||
import { type Transaction } from "./TransactionService.types"; | ||
export type ChainActivityEvent = Nullable<{ | ||
/** * The timestamp when the address was last seen on the chain. */ | ||
last_seen_at: Date; | ||
} & ChainItem>; | ||
export type ChainActivityResponse = Nullable<{ | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
updated_at: Date; | ||
/** * The requested address. */ | ||
address: string; | ||
/** * List of response items. */ | ||
items: ChainActivityEvent[]; | ||
}>; | ||
export type GetAddressActivityQueryParamOpts = Nullable<{ | ||
/** * Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. */ | ||
testnets?: boolean; | ||
}>; | ||
export type MultiChainTransaction = Transaction & { | ||
@@ -17,7 +34,7 @@ /** * The requested chain ID eg: `1`. */ | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: Quote | "ETH" | "BTC"; | ||
quote_currency: Quote | CryptocurrencyQuote; | ||
/** * List of response items. */ | ||
items: MultiChainTransaction[]; | ||
}>; | ||
export type GetMultiChainAndMultiAddressTransactionsParamOtps = Nullable<{ | ||
export type GetMultiChainMultiAddressTransactionsParamOtps = Nullable<{ | ||
/** * An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains. */ | ||
@@ -38,3 +55,71 @@ chains?: Chain[]; | ||
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, "BTC" and "ETH". */ | ||
quoteCurrency?: Quote | "BTC" | "ETH"; | ||
quoteCurrency?: Quote | CryptocurrencyQuote; | ||
}>; | ||
export type MultiChainBalanceItem = Nullable<{ | ||
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
contract_decimals: number; | ||
/** * The string returned by the `name()` method. */ | ||
contract_name: string; | ||
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */ | ||
contract_ticker_symbol: string; | ||
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */ | ||
contract_address: string; | ||
/** * A display-friendly name for the contract. */ | ||
contract_display_name: string; | ||
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ | ||
supports_erc: string[]; | ||
/** * The contract logo URL. */ | ||
logo_url: string; | ||
/** * The contract logo URLs. */ | ||
logo_urls: LogoUrls; | ||
/** * The timestamp when the token was transferred. */ | ||
last_transferred_at: Date; | ||
/** * Indicates if a token is the chain's native gas token, eg: ETH on Ethereum. */ | ||
native_token: boolean; | ||
/** * One of `cryptocurrency`, `stablecoin`, `nft` or `dust`. */ | ||
type: string; | ||
/** * Denotes whether the token is suspected spam. */ | ||
is_spam: boolean; | ||
/** * The asset balance. Use `contract_decimals` to scale this balance for display purposes. */ | ||
balance: bigint; | ||
/** * The 24h asset balance. Use `contract_decimals` to scale this balance for display purposes. */ | ||
balance_24h: bigint; | ||
/** * The exchange rate for the requested quote currency. */ | ||
quote_rate: number; | ||
/** * The 24h exchange rate for the requested quote currency. */ | ||
quote_rate_24h: number; | ||
/** * The current balance converted to fiat in `quote-currency`. */ | ||
quote: number; | ||
/** * The 24h balance converted to fiat in `quote-currency`. */ | ||
quote_24h: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * A prettier version of the 24h quote for rendering purposes. */ | ||
pretty_quote_24h: string; | ||
/** * The requested chain ID eg: `1`. */ | ||
chain_id: ChainID; | ||
/** * The requested chain name eg: `eth-mainnet`. */ | ||
chain_name: ChainName; | ||
}>; | ||
export type GetMultiChainBalanceQueryParamOpts = Nullable<{ | ||
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `ETH`, and `BTC`. */ | ||
quoteCurrency?: Quote | CryptocurrencyQuote; | ||
/** * The cursor for pagination. */ | ||
before?: string; | ||
/** * The number of items per page. Omitting this parameter defaults to 100. */ | ||
limit?: number; | ||
/** * The requested chain ID or chain names eg: `[1,137], ["eth-mainnet", "bsc-mainnet"]`. Defaults to Foundational Chains. */ | ||
chains?: ChainID[] | ChainName[]; | ||
/** * The timestamp to query balances at. If omitted, the latest balances are returned. */ | ||
cutoffTimestamp?: number; | ||
}>; | ||
export type MultiChainBalanceResponse = Nullable<{ | ||
/** * Next cursor for pagination. */ | ||
cursor_before: string; | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
updated_at: Date; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: Quote | CryptocurrencyQuote; | ||
/** * List of response items. */ | ||
items: MultiChainBalanceItem[]; | ||
}>; |
@@ -10,3 +10,3 @@ import { type ChainID, type ChainName, type ContractMetadata, type Explorer, type LogoUrls, type NftCollectionAttribute, type Nullable, type Pagination, type Quote } from "./Generic.types"; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
@@ -108,3 +108,3 @@ updated_at: Date; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -153,3 +153,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -297,3 +297,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -351,3 +351,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -354,0 +354,0 @@ chain_id: ChainID; |
@@ -1,2 +0,2 @@ | ||
import { type ChainID, type ChainName, type DecodedItem, type LogEvent, type Nullable, type Pagination, type Quote } from "./Generic.types"; | ||
import { type ChainID, type ChainLabel, type ChainName, type DecodedItem, type LogEvent, type Nullable, type Pagination, type Quote } from "./Generic.types"; | ||
export type BlockResponse = Nullable<{ | ||
@@ -185,3 +185,3 @@ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
/** * A classification of the chain */ | ||
priority_label: "Foundational" | "Frontier" | "Community"; | ||
priority_label: ChainLabel; | ||
}>; | ||
@@ -230,14 +230,2 @@ export type ColorTheme = Nullable<{ | ||
}>; | ||
export type ChainActivityResponse = Nullable<{ | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
updated_at: Date; | ||
/** * The requested address. */ | ||
address: string; | ||
/** * List of response items. */ | ||
items: ChainActivityEvent[]; | ||
}>; | ||
export type ChainActivityEvent = Nullable<{ | ||
/** * The timestamp when the address was last seen on the chain. */ | ||
last_seen_at: Date; | ||
} & ChainItem>; | ||
export type GasPricesResponse = Nullable<{ | ||
@@ -249,3 +237,3 @@ /** * The requested chain ID eg: `1`. */ | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
@@ -324,6 +312,2 @@ updated_at: Date; | ||
}>; | ||
export type GetAddressActivityQueryParamOpts = Nullable<{ | ||
/** * Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. */ | ||
testnets?: boolean; | ||
}>; | ||
export type GetGasPricesQueryParamOpts = Nullable<{ | ||
@@ -330,0 +314,0 @@ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */ |
@@ -340,2 +340,4 @@ export declare enum ChainName { | ||
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP"; | ||
export type CryptocurrencyQuote = "ETH" | "BTC"; | ||
export type ChainLabel = "Foundational" | "Frontier" | "Community"; | ||
export interface Pagination { | ||
@@ -342,0 +344,0 @@ /** * True is there is another page. */ |
@@ -1,2 +0,2 @@ | ||
import { type ChainID, type ChainName, type Nullable } from "./Generic.types"; | ||
import { type ChainID, type ChainName, type Nullable, type Quote } from "./Generic.types"; | ||
export type ApprovalsResponse = Nullable<{ | ||
@@ -8,3 +8,3 @@ /** * The requested address. */ | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -93,2 +93,4 @@ chain_id: ChainID; | ||
contract_ticker_symbol: string; | ||
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ | ||
supports_erc: string[]; | ||
/** * List of asset balances held by the user. */ | ||
@@ -95,0 +97,0 @@ token_balances: NftApprovalBalance[]; |
@@ -271,3 +271,3 @@ import { type ChainID, type ChainName, type ContractMetadata, type Explorer, type GoldRushResponse, type LogEvent, type Nullable, type PaginationLinks, type Quote } from "./Generic.types"; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -294,3 +294,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -358,3 +358,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -361,0 +361,0 @@ chain_id: ChainID; |
@@ -7,4 +7,6 @@ export { GoldRushClient } from "./src/GoldRushClient"; | ||
export { timestampParser } from "./src/utils/functions/timestamp-parser"; | ||
export * from "./src/utils/types/AllChainService.types"; | ||
export * from "./src/utils/types/BalanceService.types"; | ||
export * from "./src/utils/types/BaseService.types"; | ||
export * from "./src/utils/types/BitcoinService.types"; | ||
export * from "./src/utils/types/Generic.types"; | ||
@@ -11,0 +13,0 @@ export * from "./src/utils/types/NftService.types"; |
import { AllChainsService } from "./services/AllChainsService"; | ||
import { BalanceService } from "./services/BalanceService"; | ||
import { BaseService } from "./services/BaseService"; | ||
import { BitcoinService } from "./services/BitcoinService"; | ||
import { NftService } from "./services/NftService"; | ||
@@ -17,2 +18,3 @@ import { PricingService } from "./services/PricingService"; | ||
BaseService: BaseService; | ||
BitcoinService: BitcoinService; | ||
NftService: NftService; | ||
@@ -19,0 +21,0 @@ PricingService: PricingService; |
import { type Execution } from "../utils/functions/execution"; | ||
import { type GetMultiChainAndMultiAddressTransactionsParamOtps, type MultiChainMultiAddressTransactionsResponse } from "../utils/types/AllChainService.types"; | ||
import { type ChainActivityResponse, type GetAddressActivityQueryParamOpts, type GetMultiChainBalanceQueryParamOpts, type GetMultiChainMultiAddressTransactionsParamOtps, type MultiChainBalanceResponse, type MultiChainMultiAddressTransactionsResponse } from "../utils/types/AllChainService.types"; | ||
import { type GoldRushResponse } from "../utils/types/Generic.types"; | ||
@@ -13,2 +13,12 @@ /** | ||
* | ||
* Commonly used to locate chains which an address is active on with a single API call. | ||
* | ||
* @param {string} walletAddress - The requested wallet address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. | ||
* @param {GetAddressActivityQueryParamOpts} queryParamOpts | ||
* - `testnets`: Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. | ||
* | ||
*/ | ||
getAddressActivity(walletAddress: string, queryParamOpts?: GetAddressActivityQueryParamOpts): Promise<GoldRushResponse<ChainActivityResponse>>; | ||
/** | ||
* | ||
* Commonly used to get transactions cross chains and addresses. | ||
@@ -23,6 +33,33 @@ * | ||
* @param {boolean} withDecodedLogs - Whether to include decoded logs in the response. | ||
* @param {Quote | "BTC" | "ETH"} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, "BTC" and "ETH". | ||
* @param {Quote | CryptocurrencyQuote} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `BTC` and `ETH`. | ||
* | ||
*/ | ||
getMultiChainAndMultiAddressTransactions(queryParamOpts?: GetMultiChainAndMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>; | ||
getMultiChainMultiAddressTransactions(queryParamOpts?: GetMultiChainMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>; | ||
/** | ||
* @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getMultiChainMultiAddressTransactions` instead. | ||
* | ||
* Commonly used to get transactions cross chains and addresses. | ||
* | ||
* @param {Chain[]} chains - An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains. | ||
* @param {string[]} addresses - An array of addresses for which transactions are fetched. Does not support name resolution. | ||
* @param {number} limit - Number of transactions to return per page, up to the default max of 100 items. | ||
* @param {string} before - Pagination cursor pointing to fetch transactions before a certain point. | ||
* @param {string} after - Pagination cursor pointing to fetch transactions after a certain point. | ||
* @param {boolean} withLogs - Whether to include raw logs in the response. | ||
* @param {boolean} withDecodedLogs - Whether to include decoded logs in the response. | ||
* @param {Quote | CryptocurrencyQuote} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `BTC` and `ETH`. | ||
* | ||
*/ | ||
getMultiChainAndMultiAddressTransactions(queryParamOpts?: GetMultiChainMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>; | ||
/** | ||
* | ||
* @param {string} walletAddress - The requested wallet Address. | ||
* @param {GetMultiChainBalanceQueryParamOpts} queryParamOpts | ||
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `BTC`, and `ETH`. | ||
* - `chains`: Array chain ids or chain names to query. Limited to 10 chains. | ||
* - `limit`: The number of items to return. Default is 100. | ||
* - `timestamp`: The timestamp to query balances at. If omitted, the latest balances are returned. | ||
* - `cursorBefore`: The cursor of previous page. | ||
*/ | ||
getMultiChainBalances(walletAddress: string, queryParamOpts?: GetMultiChainBalanceQueryParamOpts): Promise<GoldRushResponse<MultiChainBalanceResponse>>; | ||
} |
import { type Execution } from "../utils/functions/execution"; | ||
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"; | ||
import { type ChainActivityResponse, type GetAddressActivityQueryParamOpts } from "../utils/types/AllChainService.types"; | ||
import { type AllChainsResponse, type AllChainsStatusResponse, type BlockHeightsResponse, type BlockResponse, type GasPricesResponse, type GetBlockHeightsQueryParamOpts, type GetGasPricesQueryParamOpts, type GetLogEventsByAddressQueryParamOpts, type GetLogEventsByTopicHashQueryParamOpts, type GetLogsQueryParamOpts, type GetLogsResponse, type LogEventsByAddressResponse, type LogEventsByTopicHashResponse, type ResolvedAddress } from "../utils/types/BaseService.types"; | ||
import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types"; | ||
@@ -143,2 +144,3 @@ /** | ||
/** | ||
* @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getAddressActivity` instead. | ||
* | ||
@@ -145,0 +147,0 @@ * Commonly used to locate chains which an address is active on with a single API call. |
@@ -1,3 +0,20 @@ | ||
import { type Chain, type ChainID, type ChainName, type Nullable, type Quote } from "./Generic.types"; | ||
import { type ChainItem } from "./BaseService.types"; | ||
import { type Chain, type ChainID, type ChainName, type CryptocurrencyQuote, type LogoUrls, type Nullable, type Quote } from "./Generic.types"; | ||
import { type Transaction } from "./TransactionService.types"; | ||
export type ChainActivityEvent = Nullable<{ | ||
/** * The timestamp when the address was last seen on the chain. */ | ||
last_seen_at: Date; | ||
} & ChainItem>; | ||
export type ChainActivityResponse = Nullable<{ | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
updated_at: Date; | ||
/** * The requested address. */ | ||
address: string; | ||
/** * List of response items. */ | ||
items: ChainActivityEvent[]; | ||
}>; | ||
export type GetAddressActivityQueryParamOpts = Nullable<{ | ||
/** * Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. */ | ||
testnets?: boolean; | ||
}>; | ||
export type MultiChainTransaction = Transaction & { | ||
@@ -17,7 +34,7 @@ /** * The requested chain ID eg: `1`. */ | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: Quote | "ETH" | "BTC"; | ||
quote_currency: Quote | CryptocurrencyQuote; | ||
/** * List of response items. */ | ||
items: MultiChainTransaction[]; | ||
}>; | ||
export type GetMultiChainAndMultiAddressTransactionsParamOtps = Nullable<{ | ||
export type GetMultiChainMultiAddressTransactionsParamOtps = Nullable<{ | ||
/** * An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains. */ | ||
@@ -38,3 +55,71 @@ chains?: Chain[]; | ||
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, "BTC" and "ETH". */ | ||
quoteCurrency?: Quote | "BTC" | "ETH"; | ||
quoteCurrency?: Quote | CryptocurrencyQuote; | ||
}>; | ||
export type MultiChainBalanceItem = Nullable<{ | ||
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */ | ||
contract_decimals: number; | ||
/** * The string returned by the `name()` method. */ | ||
contract_name: string; | ||
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */ | ||
contract_ticker_symbol: string; | ||
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */ | ||
contract_address: string; | ||
/** * A display-friendly name for the contract. */ | ||
contract_display_name: string; | ||
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ | ||
supports_erc: string[]; | ||
/** * The contract logo URL. */ | ||
logo_url: string; | ||
/** * The contract logo URLs. */ | ||
logo_urls: LogoUrls; | ||
/** * The timestamp when the token was transferred. */ | ||
last_transferred_at: Date; | ||
/** * Indicates if a token is the chain's native gas token, eg: ETH on Ethereum. */ | ||
native_token: boolean; | ||
/** * One of `cryptocurrency`, `stablecoin`, `nft` or `dust`. */ | ||
type: string; | ||
/** * Denotes whether the token is suspected spam. */ | ||
is_spam: boolean; | ||
/** * The asset balance. Use `contract_decimals` to scale this balance for display purposes. */ | ||
balance: bigint; | ||
/** * The 24h asset balance. Use `contract_decimals` to scale this balance for display purposes. */ | ||
balance_24h: bigint; | ||
/** * The exchange rate for the requested quote currency. */ | ||
quote_rate: number; | ||
/** * The 24h exchange rate for the requested quote currency. */ | ||
quote_rate_24h: number; | ||
/** * The current balance converted to fiat in `quote-currency`. */ | ||
quote: number; | ||
/** * The 24h balance converted to fiat in `quote-currency`. */ | ||
quote_24h: number; | ||
/** * A prettier version of the quote for rendering purposes. */ | ||
pretty_quote: string; | ||
/** * A prettier version of the 24h quote for rendering purposes. */ | ||
pretty_quote_24h: string; | ||
/** * The requested chain ID eg: `1`. */ | ||
chain_id: ChainID; | ||
/** * The requested chain name eg: `eth-mainnet`. */ | ||
chain_name: ChainName; | ||
}>; | ||
export type GetMultiChainBalanceQueryParamOpts = Nullable<{ | ||
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `ETH`, and `BTC`. */ | ||
quoteCurrency?: Quote | CryptocurrencyQuote; | ||
/** * The cursor for pagination. */ | ||
before?: string; | ||
/** * The number of items per page. Omitting this parameter defaults to 100. */ | ||
limit?: number; | ||
/** * The requested chain ID or chain names eg: `[1,137], ["eth-mainnet", "bsc-mainnet"]`. Defaults to Foundational Chains. */ | ||
chains?: ChainID[] | ChainName[]; | ||
/** * The timestamp to query balances at. If omitted, the latest balances are returned. */ | ||
cutoffTimestamp?: number; | ||
}>; | ||
export type MultiChainBalanceResponse = Nullable<{ | ||
/** * Next cursor for pagination. */ | ||
cursor_before: string; | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
updated_at: Date; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: Quote | CryptocurrencyQuote; | ||
/** * List of response items. */ | ||
items: MultiChainBalanceItem[]; | ||
}>; |
@@ -10,3 +10,3 @@ import { type ChainID, type ChainName, type ContractMetadata, type Explorer, type LogoUrls, type NftCollectionAttribute, type Nullable, type Pagination, type Quote } from "./Generic.types"; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
@@ -108,3 +108,3 @@ updated_at: Date; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -153,3 +153,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -297,3 +297,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -351,3 +351,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -354,0 +354,0 @@ chain_id: ChainID; |
@@ -1,2 +0,2 @@ | ||
import { type ChainID, type ChainName, type DecodedItem, type LogEvent, type Nullable, type Pagination, type Quote } from "./Generic.types"; | ||
import { type ChainID, type ChainLabel, type ChainName, type DecodedItem, type LogEvent, type Nullable, type Pagination, type Quote } from "./Generic.types"; | ||
export type BlockResponse = Nullable<{ | ||
@@ -185,3 +185,3 @@ /** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
/** * A classification of the chain */ | ||
priority_label: "Foundational" | "Frontier" | "Community"; | ||
priority_label: ChainLabel; | ||
}>; | ||
@@ -230,14 +230,2 @@ export type ColorTheme = Nullable<{ | ||
}>; | ||
export type ChainActivityResponse = Nullable<{ | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
updated_at: Date; | ||
/** * The requested address. */ | ||
address: string; | ||
/** * List of response items. */ | ||
items: ChainActivityEvent[]; | ||
}>; | ||
export type ChainActivityEvent = Nullable<{ | ||
/** * The timestamp when the address was last seen on the chain. */ | ||
last_seen_at: Date; | ||
} & ChainItem>; | ||
export type GasPricesResponse = Nullable<{ | ||
@@ -249,3 +237,3 @@ /** * The requested chain ID eg: `1`. */ | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The timestamp when the response was generated. Useful to show data staleness to users. */ | ||
@@ -324,6 +312,2 @@ updated_at: Date; | ||
}>; | ||
export type GetAddressActivityQueryParamOpts = Nullable<{ | ||
/** * Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. */ | ||
testnets?: boolean; | ||
}>; | ||
export type GetGasPricesQueryParamOpts = Nullable<{ | ||
@@ -330,0 +314,0 @@ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */ |
@@ -340,2 +340,4 @@ export declare enum ChainName { | ||
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP"; | ||
export type CryptocurrencyQuote = "ETH" | "BTC"; | ||
export type ChainLabel = "Foundational" | "Frontier" | "Community"; | ||
export interface Pagination { | ||
@@ -342,0 +344,0 @@ /** * True is there is another page. */ |
@@ -1,2 +0,2 @@ | ||
import { type ChainID, type ChainName, type Nullable } from "./Generic.types"; | ||
import { type ChainID, type ChainName, type Nullable, type Quote } from "./Generic.types"; | ||
export type ApprovalsResponse = Nullable<{ | ||
@@ -8,3 +8,3 @@ /** * The requested address. */ | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -93,2 +93,4 @@ chain_id: ChainID; | ||
contract_ticker_symbol: string; | ||
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */ | ||
supports_erc: string[]; | ||
/** * List of asset balances held by the user. */ | ||
@@ -95,0 +97,0 @@ token_balances: NftApprovalBalance[]; |
@@ -271,3 +271,3 @@ import { type ChainID, type ChainName, type ContractMetadata, type Explorer, type GoldRushResponse, type LogEvent, type Nullable, type PaginationLinks, type Quote } from "./Generic.types"; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -294,3 +294,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -358,3 +358,3 @@ chain_id: ChainID; | ||
/** * The requested quote currency eg: `USD`. */ | ||
quote_currency: string; | ||
quote_currency: Quote; | ||
/** * The requested chain ID eg: `1`. */ | ||
@@ -361,0 +361,0 @@ chain_id: ChainID; |
{ | ||
"name": "@covalenthq/client-sdk", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"license": "Apache-2.0", | ||
@@ -50,3 +50,3 @@ "repository": { | ||
"pretty": "prettier . --write", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "npm run clean && npm run build" | ||
}, | ||
@@ -53,0 +53,0 @@ "publishConfig": { |
@@ -241,3 +241,5 @@ <div align="center"> | ||
- `getMultiChainAndMultiAddressTransactions()`: Fetch and render the transactions across multiple chains and addresses | ||
- `getAddressActivity()`: Locate chains where an address is active on with a single API call. | ||
- `getMultiChainMultiAddressTransactions()`: Fetch and render the transactions across multiple chains and addresses | ||
- `getMultiChainBalances()`: Fetch the token balances of an address for multiple chains. (limited to 10 chains at a time) | ||
</details> | ||
@@ -285,3 +287,2 @@ | ||
- `getAllChainStatus()`: Used to build internal status dashboards of all supported chains. | ||
- `getAddressActivity()`: Locate chains where an address is active on with a single API call. | ||
- `getGasPrices()`: Get real-time gas estimates for different transaction speeds on a specific network, enabling users to optimize transaction costs and confirmation times. | ||
@@ -292,5 +293,15 @@ </details> | ||
<summary> | ||
5. <strong>NFT Service</strong>: Access to the NFT endpoints | ||
5. <strong>Bitcoin Service</strong>: Access to the Bitcoin wallet endpoints | ||
</summary> | ||
- `getBitcoinHdWalletBalances()`: Fetch balances for each active child address derived from a Bitcoin HD wallet. | ||
- `getTokenBalancesForWalletAddress()`: Fetch the native, fungible (ERC20), and non-fungible (ERC721 & ERC1155) tokens held by an address. Response includes spot prices and other metadata. | ||
- `getTransactionsForBtcAddress()`: Used to fetch the full transaction history of a Bitcoin wallet. Only supports non-HD bitcoin addresses. | ||
</details> | ||
<details> | ||
<summary> | ||
6. <strong>NFT Service</strong>: Access to the NFT endpoints | ||
</summary> | ||
- `getChainCollections()`: Used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files. (Paginated) | ||
@@ -312,3 +323,3 @@ - `getChainCollectionsByPage()`: Used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files. (Nonpaginated) | ||
<summary> | ||
6. <strong>Pricing Service</strong>: Access to the historical token prices endpoint | ||
7. <strong>Pricing Service</strong>: Access to the historical token prices endpoint | ||
</summary> | ||
@@ -321,3 +332,3 @@ | ||
<summary> | ||
7. <strong>Transaction Service</strong>: Access to the transactions endpoints | ||
8. <strong>Transaction Service</strong>: Access to the transactions endpoints | ||
</summary> | ||
@@ -324,0 +335,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
1335783
63
14590
354
3