@covalenthq/client-sdk 2.2.1 → 2.2.2
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 +353 -342
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +2863 -2628
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/GoldRushClient.d.ts +2 -0
- package/dist/cjs/src/services/AllChainsService.d.ts +40 -3
- package/dist/cjs/src/services/BaseService.d.ts +3 -1
- package/dist/cjs/src/services/BitcoinService.d.ts +40 -0
- package/dist/cjs/src/utils/types/AllChainService.types.d.ts +89 -4
- package/dist/cjs/src/utils/types/BalanceService.types.d.ts +5 -5
- package/dist/cjs/src/utils/types/BaseService.types.d.ts +3 -19
- package/dist/cjs/src/utils/types/BitcoinService.types.d.ts +88 -0
- package/dist/cjs/src/utils/types/Generic.types.d.ts +2 -0
- package/dist/cjs/src/utils/types/SecurityService.types.d.ts +4 -2
- package/dist/cjs/src/utils/types/TransactionService.types.d.ts +3 -3
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2863 -2628
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/GoldRushClient.d.ts +2 -0
- package/dist/esm/src/services/AllChainsService.d.ts +40 -3
- package/dist/esm/src/services/BaseService.d.ts +3 -1
- package/dist/esm/src/services/BitcoinService.d.ts +40 -0
- package/dist/esm/src/utils/types/AllChainService.types.d.ts +89 -4
- package/dist/esm/src/utils/types/BalanceService.types.d.ts +5 -5
- package/dist/esm/src/utils/types/BaseService.types.d.ts +3 -19
- package/dist/esm/src/utils/types/BitcoinService.types.d.ts +88 -0
- package/dist/esm/src/utils/types/Generic.types.d.ts +2 -0
- package/dist/esm/src/utils/types/SecurityService.types.d.ts +4 -2
- package/dist/esm/src/utils/types/TransactionService.types.d.ts +3 -3
- package/package.json +73 -73
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AllChainsService } from "./services/AllChainsService";
|
|
2
2
|
import { BalanceService } from "./services/BalanceService";
|
|
3
3
|
import { BaseService } from "./services/BaseService";
|
|
4
|
+
import { BitcoinService } from "./services/BitcoinService";
|
|
4
5
|
import { NftService } from "./services/NftService";
|
|
5
6
|
import { PricingService } from "./services/PricingService";
|
|
6
7
|
import { SecurityService } from "./services/SecurityService";
|
|
@@ -14,6 +15,7 @@ export declare class GoldRushClient {
|
|
|
14
15
|
AllChainsService: AllChainsService;
|
|
15
16
|
BalanceService: BalanceService;
|
|
16
17
|
BaseService: BaseService;
|
|
18
|
+
BitcoinService: BitcoinService;
|
|
17
19
|
NftService: NftService;
|
|
18
20
|
PricingService: PricingService;
|
|
19
21
|
SecurityService: SecurityService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Execution } from "../utils/functions/execution";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ChainActivityResponse, type GetAddressActivityQueryParamOpts, type GetMultiChainBalanceQueryParamOpts, type GetMultiChainMultiAddressTransactionsParamOtps, type MultiChainBalanceResponse, type MultiChainMultiAddressTransactionsResponse } from "../utils/types/AllChainService.types";
|
|
3
3
|
import { type GoldRushResponse } from "../utils/types/Generic.types";
|
|
4
4
|
/**
|
|
5
5
|
* Cross Chain API
|
|
@@ -8,6 +8,16 @@ import { type GoldRushResponse } from "../utils/types/Generic.types";
|
|
|
8
8
|
export declare class AllChainsService {
|
|
9
9
|
private execution;
|
|
10
10
|
constructor(execution: Execution);
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* Commonly used to locate chains which an address is active on with a single API call.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} walletAddress - The requested wallet address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
16
|
+
* @param {GetAddressActivityQueryParamOpts} queryParamOpts
|
|
17
|
+
* - `testnets`: Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
getAddressActivity(walletAddress: string, queryParamOpts?: GetAddressActivityQueryParamOpts): Promise<GoldRushResponse<ChainActivityResponse>>;
|
|
11
21
|
/**
|
|
12
22
|
*
|
|
13
23
|
* Commonly used to get transactions cross chains and addresses.
|
|
@@ -19,8 +29,35 @@ export declare class AllChainsService {
|
|
|
19
29
|
* @param {string} after - Pagination cursor pointing to fetch transactions after a certain point.
|
|
20
30
|
* @param {boolean} withLogs - Whether to include raw logs in the response.
|
|
21
31
|
* @param {boolean} withDecodedLogs - Whether to include decoded logs in the response.
|
|
22
|
-
* @param {Quote |
|
|
32
|
+
* @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`.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
getMultiChainMultiAddressTransactions(queryParamOpts?: GetMultiChainMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getMultiChainMultiAddressTransactions` instead.
|
|
38
|
+
*
|
|
39
|
+
* Commonly used to get transactions cross chains and addresses.
|
|
40
|
+
*
|
|
41
|
+
* @param {Chain[]} chains - An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains.
|
|
42
|
+
* @param {string[]} addresses - An array of addresses for which transactions are fetched. Does not support name resolution.
|
|
43
|
+
* @param {number} limit - Number of transactions to return per page, up to the default max of 100 items.
|
|
44
|
+
* @param {string} before - Pagination cursor pointing to fetch transactions before a certain point.
|
|
45
|
+
* @param {string} after - Pagination cursor pointing to fetch transactions after a certain point.
|
|
46
|
+
* @param {boolean} withLogs - Whether to include raw logs in the response.
|
|
47
|
+
* @param {boolean} withDecodedLogs - Whether to include decoded logs in the response.
|
|
48
|
+
* @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`.
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
getMultiChainAndMultiAddressTransactions(queryParamOpts?: GetMultiChainMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>;
|
|
52
|
+
/**
|
|
23
53
|
*
|
|
54
|
+
* @param {string} walletAddress - The requested wallet Address.
|
|
55
|
+
* @param {GetMultiChainBalanceQueryParamOpts} queryParamOpts
|
|
56
|
+
* - `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`.
|
|
57
|
+
* - `chains`: Array chain ids or chain names to query. Limited to 10 chains.
|
|
58
|
+
* - `limit`: The number of items to return. Default is 100.
|
|
59
|
+
* - `timestamp`: The timestamp to query balances at. If omitted, the latest balances are returned.
|
|
60
|
+
* - `cursorBefore`: The cursor of previous page.
|
|
24
61
|
*/
|
|
25
|
-
|
|
62
|
+
getMultiChainBalances(walletAddress: string, queryParamOpts?: GetMultiChainBalanceQueryParamOpts): Promise<GoldRushResponse<MultiChainBalanceResponse>>;
|
|
26
63
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Execution } from "../utils/functions/execution";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ChainActivityResponse, type GetAddressActivityQueryParamOpts } from "../utils/types/AllChainService.types";
|
|
3
|
+
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";
|
|
3
4
|
import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types";
|
|
4
5
|
/**
|
|
5
6
|
* Base API
|
|
@@ -140,6 +141,7 @@ export declare class BaseService {
|
|
|
140
141
|
*/
|
|
141
142
|
getAllChainStatus(): Promise<GoldRushResponse<AllChainsStatusResponse>>;
|
|
142
143
|
/**
|
|
144
|
+
* @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getAddressActivity` instead.
|
|
143
145
|
*
|
|
144
146
|
* Commonly used to locate chains which an address is active on with a single API call.
|
|
145
147
|
*
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Execution } from "../utils/functions/execution";
|
|
2
|
+
import { type BalancesResponse } from "../utils/types/BalanceService.types";
|
|
3
|
+
import { type BitcoinHdWalletBalancesResponse, type BitcoinTransactionResponse, type GetBitcoinHdWalletBalancesQueryParamOpts, type GetBitcoinNonHdWalletBalancesQueryParamOpts, type GetTransactionsForBitcoinAddressParamOpts } from "../utils/types/BitcoinService.types";
|
|
4
|
+
import { type GoldRushResponse } from "../utils/types/Generic.types";
|
|
5
|
+
/**
|
|
6
|
+
* Bitcoin APIs
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare class BitcoinService {
|
|
10
|
+
private execution;
|
|
11
|
+
constructor(execution: Execution);
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {string} walletAddress - The requested Bitcoin HD address.
|
|
15
|
+
* @param {GetBitcoinHdWalletBalancesQueryParamOpts} queryParamOpts
|
|
16
|
+
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
getBitcoinHdWalletBalances(walletAddress: string, queryParamOpts?: GetBitcoinHdWalletBalancesQueryParamOpts): Promise<GoldRushResponse<BitcoinHdWalletBalancesResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* Used to fetch the full transaction history of a Bitcoin wallet.
|
|
23
|
+
*
|
|
24
|
+
* @param {GetTransactionsForBitcoinAddressParamOpts} queryParamOpts
|
|
25
|
+
* - `address`: The bitcoin address to query.
|
|
26
|
+
* - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
|
|
27
|
+
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
28
|
+
*/
|
|
29
|
+
getTransactionsForBtcAddress(queryParamOpts?: GetTransactionsForBitcoinAddressParamOpts): Promise<GoldRushResponse<BitcoinTransactionResponse>>;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* Commonly used to fetch the tokens held by an address. Response includes spot prices and other metadata.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} walletAddress - The requested Bitcoin Non HD address.
|
|
35
|
+
* @param {GetBitcoinNonHdWalletBalancesQueryParamOpts} queryParamOpts
|
|
36
|
+
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
getBitcoinNonHdWalletBalances(walletAddress: string, queryParamOpts?: GetBitcoinNonHdWalletBalancesQueryParamOpts): Promise<GoldRushResponse<BalancesResponse>>;
|
|
40
|
+
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ChainItem } from "./BaseService.types";
|
|
2
|
+
import { type Chain, type ChainID, type ChainName, type CryptocurrencyQuote, type LogoUrls, type Nullable, type Quote } from "./Generic.types";
|
|
2
3
|
import { type Transaction } from "./TransactionService.types";
|
|
4
|
+
export type ChainActivityEvent = Nullable<{
|
|
5
|
+
/** * The timestamp when the address was last seen on the chain. */
|
|
6
|
+
last_seen_at: Date;
|
|
7
|
+
} & ChainItem>;
|
|
8
|
+
export type ChainActivityResponse = Nullable<{
|
|
9
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
10
|
+
updated_at: Date;
|
|
11
|
+
/** * The requested address. */
|
|
12
|
+
address: string;
|
|
13
|
+
/** * List of response items. */
|
|
14
|
+
items: ChainActivityEvent[];
|
|
15
|
+
}>;
|
|
16
|
+
export type GetAddressActivityQueryParamOpts = Nullable<{
|
|
17
|
+
/** * Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. */
|
|
18
|
+
testnets?: boolean;
|
|
19
|
+
}>;
|
|
3
20
|
export type MultiChainTransaction = Transaction & {
|
|
4
21
|
/** * The requested chain ID eg: `1`. */
|
|
5
22
|
chain_id: ChainID;
|
|
@@ -14,11 +31,11 @@ export type MultiChainMultiAddressTransactionsResponse = Nullable<{
|
|
|
14
31
|
/** * The the pagination cursor to get the next page of results */
|
|
15
32
|
cursor_after: string;
|
|
16
33
|
/** * The requested quote currency eg: `USD`. */
|
|
17
|
-
quote_currency: Quote |
|
|
34
|
+
quote_currency: Quote | CryptocurrencyQuote;
|
|
18
35
|
/** * List of response items. */
|
|
19
36
|
items: MultiChainTransaction[];
|
|
20
37
|
}>;
|
|
21
|
-
export type
|
|
38
|
+
export type GetMultiChainMultiAddressTransactionsParamOtps = Nullable<{
|
|
22
39
|
/** * An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains. */
|
|
23
40
|
chains?: Chain[];
|
|
24
41
|
/** * An array of addresses for which transactions are fetched. Does not support name resolution. */
|
|
@@ -34,5 +51,73 @@ export type GetMultiChainAndMultiAddressTransactionsParamOtps = Nullable<{
|
|
|
34
51
|
/** * Whether to include decoded logs in the response. */
|
|
35
52
|
withDecodedLogs?: boolean;
|
|
36
53
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, "BTC" and "ETH". */
|
|
37
|
-
quoteCurrency?: Quote |
|
|
54
|
+
quoteCurrency?: Quote | CryptocurrencyQuote;
|
|
55
|
+
}>;
|
|
56
|
+
export type MultiChainBalanceItem = Nullable<{
|
|
57
|
+
/** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
|
|
58
|
+
contract_decimals: number;
|
|
59
|
+
/** * The string returned by the `name()` method. */
|
|
60
|
+
contract_name: string;
|
|
61
|
+
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
|
|
62
|
+
contract_ticker_symbol: string;
|
|
63
|
+
/** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
|
|
64
|
+
contract_address: string;
|
|
65
|
+
/** * A display-friendly name for the contract. */
|
|
66
|
+
contract_display_name: string;
|
|
67
|
+
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
|
|
68
|
+
supports_erc: string[];
|
|
69
|
+
/** * The contract logo URL. */
|
|
70
|
+
logo_url: string;
|
|
71
|
+
/** * The contract logo URLs. */
|
|
72
|
+
logo_urls: LogoUrls;
|
|
73
|
+
/** * The timestamp when the token was transferred. */
|
|
74
|
+
last_transferred_at: Date;
|
|
75
|
+
/** * Indicates if a token is the chain's native gas token, eg: ETH on Ethereum. */
|
|
76
|
+
native_token: boolean;
|
|
77
|
+
/** * One of `cryptocurrency`, `stablecoin`, `nft` or `dust`. */
|
|
78
|
+
type: string;
|
|
79
|
+
/** * Denotes whether the token is suspected spam. */
|
|
80
|
+
is_spam: boolean;
|
|
81
|
+
/** * The asset balance. Use `contract_decimals` to scale this balance for display purposes. */
|
|
82
|
+
balance: bigint;
|
|
83
|
+
/** * The 24h asset balance. Use `contract_decimals` to scale this balance for display purposes. */
|
|
84
|
+
balance_24h: bigint;
|
|
85
|
+
/** * The exchange rate for the requested quote currency. */
|
|
86
|
+
quote_rate: number;
|
|
87
|
+
/** * The 24h exchange rate for the requested quote currency. */
|
|
88
|
+
quote_rate_24h: number;
|
|
89
|
+
/** * The current balance converted to fiat in `quote-currency`. */
|
|
90
|
+
quote: number;
|
|
91
|
+
/** * The 24h balance converted to fiat in `quote-currency`. */
|
|
92
|
+
quote_24h: number;
|
|
93
|
+
/** * A prettier version of the quote for rendering purposes. */
|
|
94
|
+
pretty_quote: string;
|
|
95
|
+
/** * A prettier version of the 24h quote for rendering purposes. */
|
|
96
|
+
pretty_quote_24h: string;
|
|
97
|
+
/** * The requested chain ID eg: `1`. */
|
|
98
|
+
chain_id: ChainID;
|
|
99
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
100
|
+
chain_name: ChainName;
|
|
101
|
+
}>;
|
|
102
|
+
export type GetMultiChainBalanceQueryParamOpts = Nullable<{
|
|
103
|
+
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `ETH`, and `BTC`. */
|
|
104
|
+
quoteCurrency?: Quote | CryptocurrencyQuote;
|
|
105
|
+
/** * The cursor for pagination. */
|
|
106
|
+
before?: string;
|
|
107
|
+
/** * The number of items per page. Omitting this parameter defaults to 100. */
|
|
108
|
+
limit?: number;
|
|
109
|
+
/** * The requested chain ID or chain names eg: `[1,137], ["eth-mainnet", "bsc-mainnet"]`. Defaults to Foundational Chains. */
|
|
110
|
+
chains?: ChainID[] | ChainName[];
|
|
111
|
+
/** * The timestamp to query balances at. If omitted, the latest balances are returned. */
|
|
112
|
+
cutoffTimestamp?: number;
|
|
113
|
+
}>;
|
|
114
|
+
export type MultiChainBalanceResponse = Nullable<{
|
|
115
|
+
/** * Next cursor for pagination. */
|
|
116
|
+
cursor_before: string;
|
|
117
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
118
|
+
updated_at: Date;
|
|
119
|
+
/** * The requested quote currency eg: `USD`. */
|
|
120
|
+
quote_currency: Quote | CryptocurrencyQuote;
|
|
121
|
+
/** * List of response items. */
|
|
122
|
+
items: MultiChainBalanceItem[];
|
|
38
123
|
}>;
|
|
@@ -7,7 +7,7 @@ export type BalancesResponse = Nullable<{
|
|
|
7
7
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
8
8
|
chain_name: ChainName;
|
|
9
9
|
/** * The requested quote currency eg: `USD`. */
|
|
10
|
-
quote_currency:
|
|
10
|
+
quote_currency: Quote;
|
|
11
11
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
12
12
|
updated_at: Date;
|
|
13
13
|
/** * List of response items. */
|
|
@@ -104,7 +104,7 @@ export type PortfolioResponse = Nullable<{
|
|
|
104
104
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
105
105
|
updated_at: Date;
|
|
106
106
|
/** * The requested quote currency eg: `USD`. */
|
|
107
|
-
quote_currency:
|
|
107
|
+
quote_currency: Quote;
|
|
108
108
|
/** * The requested chain ID eg: `1`. */
|
|
109
109
|
chain_id: ChainID;
|
|
110
110
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -148,7 +148,7 @@ export type Erc20TransfersResponse = Nullable<{
|
|
|
148
148
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
149
149
|
updated_at: Date;
|
|
150
150
|
/** * The requested quote currency eg: `USD`. */
|
|
151
|
-
quote_currency:
|
|
151
|
+
quote_currency: Quote;
|
|
152
152
|
/** * The requested chain ID eg: `1`. */
|
|
153
153
|
chain_id: ChainID;
|
|
154
154
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -291,7 +291,7 @@ export type HistoricalBalancesResponse = Nullable<{
|
|
|
291
291
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
292
292
|
updated_at: Date;
|
|
293
293
|
/** * The requested quote currency eg: `USD`. */
|
|
294
|
-
quote_currency:
|
|
294
|
+
quote_currency: Quote;
|
|
295
295
|
/** * The requested chain ID eg: `1`. */
|
|
296
296
|
chain_id: ChainID;
|
|
297
297
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -344,7 +344,7 @@ export type TokenBalanceNativeResponse = Nullable<{
|
|
|
344
344
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
345
345
|
updated_at: Date;
|
|
346
346
|
/** * The requested quote currency eg: `USD`. */
|
|
347
|
-
quote_currency:
|
|
347
|
+
quote_currency: Quote;
|
|
348
348
|
/** * The requested chain ID eg: `1`. */
|
|
349
349
|
chain_id: ChainID;
|
|
350
350
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChainID, type ChainName, type DecodedItem, type LogEvent, type Nullable, type Pagination, type Quote } from "./Generic.types";
|
|
1
|
+
import { type ChainID, type ChainLabel, type ChainName, type DecodedItem, type LogEvent, type Nullable, type Pagination, type Quote } from "./Generic.types";
|
|
2
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;
|
|
@@ -182,7 +182,7 @@ export type ChainItem = Nullable<{
|
|
|
182
182
|
/** * The ChainItem the appchain is a part of. */
|
|
183
183
|
appchain_of: ChainItem;
|
|
184
184
|
/** * A classification of the chain */
|
|
185
|
-
priority_label:
|
|
185
|
+
priority_label: ChainLabel;
|
|
186
186
|
}>;
|
|
187
187
|
export type ColorTheme = Nullable<{
|
|
188
188
|
/** * The red color code. */
|
|
@@ -226,25 +226,13 @@ export type ChainStatusItem = Nullable<{
|
|
|
226
226
|
/** * True if the chain has data and ready for querying. */
|
|
227
227
|
has_data: boolean;
|
|
228
228
|
}>;
|
|
229
|
-
export type ChainActivityResponse = Nullable<{
|
|
230
|
-
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
231
|
-
updated_at: Date;
|
|
232
|
-
/** * The requested address. */
|
|
233
|
-
address: string;
|
|
234
|
-
/** * List of response items. */
|
|
235
|
-
items: ChainActivityEvent[];
|
|
236
|
-
}>;
|
|
237
|
-
export type ChainActivityEvent = Nullable<{
|
|
238
|
-
/** * The timestamp when the address was last seen on the chain. */
|
|
239
|
-
last_seen_at: Date;
|
|
240
|
-
} & ChainItem>;
|
|
241
229
|
export type GasPricesResponse = Nullable<{
|
|
242
230
|
/** * The requested chain ID eg: `1`. */
|
|
243
231
|
chain_id: ChainID;
|
|
244
232
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
245
233
|
chain_name: ChainName;
|
|
246
234
|
/** * The requested quote currency eg: `USD`. */
|
|
247
|
-
quote_currency:
|
|
235
|
+
quote_currency: Quote;
|
|
248
236
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
249
237
|
updated_at: Date;
|
|
250
238
|
/** * The requested event type. */
|
|
@@ -318,10 +306,6 @@ export type GetLogEventsByTopicHashQueryParamOpts = Nullable<{
|
|
|
318
306
|
/** * 0-indexed page number to begin pagination. */
|
|
319
307
|
pageNumber?: number;
|
|
320
308
|
}>;
|
|
321
|
-
export type GetAddressActivityQueryParamOpts = Nullable<{
|
|
322
|
-
/** * Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity. */
|
|
323
|
-
testnets?: boolean;
|
|
324
|
-
}>;
|
|
325
309
|
export type GetGasPricesQueryParamOpts = Nullable<{
|
|
326
310
|
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
327
311
|
quoteCurrency?: Quote;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type BalanceItem } from "./BalanceService.types";
|
|
2
|
+
import { type ChainID, type ChainName, type Nullable, type Pagination, type Quote } from "./Generic.types";
|
|
3
|
+
export type GetBitcoinHdWalletBalancesQueryParamOpts = Nullable<{
|
|
4
|
+
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
5
|
+
quoteCurrency?: Quote;
|
|
6
|
+
}>;
|
|
7
|
+
export type BitcoinHdWalletBalancesResponse = Nullable<{
|
|
8
|
+
/** * The requested address. */
|
|
9
|
+
address: string;
|
|
10
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
11
|
+
updated_at: Date;
|
|
12
|
+
/** * The requested quote currency eg: `USD`. */
|
|
13
|
+
quote_currency: Quote;
|
|
14
|
+
/** * Bitcoin chain ID. */
|
|
15
|
+
chain_id: ChainID;
|
|
16
|
+
/** * Bitcoin Chain Name. */
|
|
17
|
+
chain_name: ChainName;
|
|
18
|
+
/** * List of response items. */
|
|
19
|
+
items: BitcoinHdWalletBalanceItem[];
|
|
20
|
+
}>;
|
|
21
|
+
export type BitcoinHdWalletBalanceItem = BalanceItem & Nullable<{
|
|
22
|
+
/** * The specific Bitcoin address derived from the HD wallet. */
|
|
23
|
+
child_address: string;
|
|
24
|
+
/** * Derivation path used to derive the specific Bitcoin address, e.g., M/0H/0/0. */
|
|
25
|
+
address_path: string;
|
|
26
|
+
/** * The HD wallet path. */
|
|
27
|
+
hd_wallet_path: string;
|
|
28
|
+
}>;
|
|
29
|
+
export type GetTransactionsForBitcoinAddressParamOpts = Nullable<{
|
|
30
|
+
/** * The bitcoin address to query. */
|
|
31
|
+
address?: string;
|
|
32
|
+
/** * Omit log events. */
|
|
33
|
+
pageSize?: number;
|
|
34
|
+
/** * Include safe details. */
|
|
35
|
+
pageNumber?: number;
|
|
36
|
+
}>;
|
|
37
|
+
export type GetBitcoinNonHdWalletBalancesQueryParamOpts = Nullable<{
|
|
38
|
+
/** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
|
|
39
|
+
quoteCurrency?: Quote;
|
|
40
|
+
}>;
|
|
41
|
+
export type BitcoinTransactionResponse = Nullable<{
|
|
42
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
43
|
+
updated_at: Date;
|
|
44
|
+
/** * List of response items. */
|
|
45
|
+
items: BitcoinTransaction[];
|
|
46
|
+
/** * Pagination metadata. */
|
|
47
|
+
pagination: Pagination;
|
|
48
|
+
}>;
|
|
49
|
+
export type BitcoinTransaction = Nullable<{
|
|
50
|
+
/** The requested chain ID eg: 20090103. */
|
|
51
|
+
chain_id: number;
|
|
52
|
+
/** The requested chain name eg: btc-mainnet. */
|
|
53
|
+
chain_name: string;
|
|
54
|
+
/** Use contract decimals to format the token balance for display purposes - divide the balance by 10^{contract_decimals}. */
|
|
55
|
+
contract_decimals: number;
|
|
56
|
+
/** The block signed timestamp in UTC. */
|
|
57
|
+
block_signed_at: Date;
|
|
58
|
+
/** The height of the block. */
|
|
59
|
+
block_height: number;
|
|
60
|
+
/** The hash of the block. */
|
|
61
|
+
block_hash: string;
|
|
62
|
+
/** The requested transaction hash. */
|
|
63
|
+
tx_hash: string;
|
|
64
|
+
/** The position index of the tx in the block. */
|
|
65
|
+
tx_idx: number;
|
|
66
|
+
/** Either 'input' as the sender or 'output' as the receiver of btc. */
|
|
67
|
+
type: string;
|
|
68
|
+
/** The wallet address. */
|
|
69
|
+
address: string;
|
|
70
|
+
/** The value attached to this tx in satoshi. */
|
|
71
|
+
value: bigint;
|
|
72
|
+
/** The value attached to this tx in USD. */
|
|
73
|
+
quote: number;
|
|
74
|
+
/** The value token exchange rate in USD. */
|
|
75
|
+
quote_rate: number;
|
|
76
|
+
/** The total transaction fees denoted in satoshi. */
|
|
77
|
+
fees_paid: bigint;
|
|
78
|
+
/** The gas spent in USD. */
|
|
79
|
+
gas_quote: number;
|
|
80
|
+
/** The native gas token exchange rate in USD. */
|
|
81
|
+
gas_quote_rate: number;
|
|
82
|
+
/** Indicates if this is a coinbase tx where btc is rewarded to a miner for validating the block. */
|
|
83
|
+
coinbase: boolean;
|
|
84
|
+
/** The earliest Unix timestamp or block height at which the tx is valid and can be included. Is 0 if no restriction. */
|
|
85
|
+
locktime: number;
|
|
86
|
+
/** A measure that reflects impact on the block size limit. Used to determine fees. */
|
|
87
|
+
weight: number;
|
|
88
|
+
}>;
|
|
@@ -337,6 +337,8 @@ export declare enum ChainID {
|
|
|
337
337
|
export type Chain = ChainID | ChainName | `${ChainName}` | `${ChainID}`;
|
|
338
338
|
export type Source = "Ponder" | "GoldRush" | "Viem";
|
|
339
339
|
export type Quote = "USD" | "CAD" | "EUR" | "SGD" | "INR" | "JPY" | "VND" | "CNY" | "KRW" | "RUB" | "TRY" | "NGN" | "ARS" | "AUD" | "CHF" | "GBP";
|
|
340
|
+
export type CryptocurrencyQuote = "ETH" | "BTC";
|
|
341
|
+
export type ChainLabel = "Foundational" | "Frontier" | "Community";
|
|
340
342
|
export interface Pagination {
|
|
341
343
|
/** * True is there is another page. */
|
|
342
344
|
has_more: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type ChainID, type ChainName, type Nullable } from "./Generic.types";
|
|
1
|
+
import { type ChainID, type ChainName, type Nullable, type Quote } from "./Generic.types";
|
|
2
2
|
export type ApprovalsResponse = Nullable<{
|
|
3
3
|
/** * The requested address. */
|
|
4
4
|
address: string;
|
|
5
5
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
6
6
|
updated_at: Date;
|
|
7
7
|
/** * The requested quote currency eg: `USD`. */
|
|
8
|
-
quote_currency:
|
|
8
|
+
quote_currency: Quote;
|
|
9
9
|
/** * The requested chain ID eg: `1`. */
|
|
10
10
|
chain_id: ChainID;
|
|
11
11
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -89,6 +89,8 @@ export type NftApprovalsItem = Nullable<{
|
|
|
89
89
|
contract_address_label: string;
|
|
90
90
|
/** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
|
|
91
91
|
contract_ticker_symbol: string;
|
|
92
|
+
/** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
|
|
93
|
+
supports_erc: string[];
|
|
92
94
|
/** * List of asset balances held by the user. */
|
|
93
95
|
token_balances: NftApprovalBalance[];
|
|
94
96
|
/** * Contracts with non-zero approvals for this token. */
|
|
@@ -268,7 +268,7 @@ export type RecentTransactionsResponse = Nullable<{
|
|
|
268
268
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
269
269
|
updated_at: Date;
|
|
270
270
|
/** * The requested quote currency eg: `USD`. */
|
|
271
|
-
quote_currency:
|
|
271
|
+
quote_currency: Quote;
|
|
272
272
|
/** * The requested chain ID eg: `1`. */
|
|
273
273
|
chain_id: ChainID;
|
|
274
274
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -290,7 +290,7 @@ export type TransactionsTimeBucketResponse = Nullable<{
|
|
|
290
290
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
291
291
|
updated_at: Date;
|
|
292
292
|
/** * The requested quote currency eg: `USD`. */
|
|
293
|
-
quote_currency:
|
|
293
|
+
quote_currency: Quote;
|
|
294
294
|
/** * The requested chain ID eg: `1`. */
|
|
295
295
|
chain_id: ChainID;
|
|
296
296
|
/** * The requested chain name eg: `eth-mainnet`. */
|
|
@@ -353,7 +353,7 @@ export type TransactionsResponse = Nullable<{
|
|
|
353
353
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
354
354
|
updated_at: Date;
|
|
355
355
|
/** * The requested quote currency eg: `USD`. */
|
|
356
|
-
quote_currency:
|
|
356
|
+
quote_currency: Quote;
|
|
357
357
|
/** * The requested chain ID eg: `1`. */
|
|
358
358
|
chain_id: ChainID;
|
|
359
359
|
/** * The requested chain name eg: `eth-mainnet`. */
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ export { calculatePrettyBalance } from "./src/utils/functions/calculatePrettyBal
|
|
|
4
4
|
export { isValidApiKey } from "./src/utils/functions/isValidApiKey";
|
|
5
5
|
export { prettifyCurrency } from "./src/utils/functions/prettifyCurrency";
|
|
6
6
|
export { timestampParser } from "./src/utils/functions/timestamp-parser";
|
|
7
|
+
export * from "./src/utils/types/AllChainService.types";
|
|
7
8
|
export * from "./src/utils/types/BalanceService.types";
|
|
8
9
|
export * from "./src/utils/types/BaseService.types";
|
|
10
|
+
export * from "./src/utils/types/BitcoinService.types";
|
|
9
11
|
export * from "./src/utils/types/Generic.types";
|
|
10
12
|
export * from "./src/utils/types/NftService.types";
|
|
11
13
|
export * from "./src/utils/types/PricingService.types";
|