@covalenthq/client-sdk 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +223 -282
  3. package/package.json +25 -12
  4. package/dist/cjs/index.d.ts +0 -20
  5. package/dist/cjs/index.js +0 -8190
  6. package/dist/cjs/index.js.map +0 -1
  7. package/dist/cjs/services/BalanceService.d.ts +0 -638
  8. package/dist/cjs/services/BaseService.d.ts +0 -571
  9. package/dist/cjs/services/CovalentClient.d.ts +0 -57
  10. package/dist/cjs/services/NftService.d.ts +0 -686
  11. package/dist/cjs/services/PricingService.d.ts +0 -103
  12. package/dist/cjs/services/SecurityService.d.ts +0 -162
  13. package/dist/cjs/services/TransactionService.d.ts +0 -711
  14. package/dist/cjs/services/XykService.d.ts +0 -1018
  15. package/dist/cjs/util/ApiHelpers.d.ts +0 -6
  16. package/dist/cjs/util/ApiKeyValidator.d.ts +0 -8
  17. package/dist/cjs/util/CalculatePrettyBalance.d.ts +0 -1
  18. package/dist/cjs/util/Chains.d.ts +0 -223
  19. package/dist/cjs/util/backoff.d.ts +0 -12
  20. package/dist/cjs/util/prettifyCurrency.d.ts +0 -2
  21. package/dist/cjs/util/types/BalanceServiceTypes.d.ts +0 -378
  22. package/dist/cjs/util/types/BaseServiceTypes.d.ts +0 -276
  23. package/dist/cjs/util/types/GenericTypes.d.ts +0 -116
  24. package/dist/cjs/util/types/NftServiceTypes.d.ts +0 -303
  25. package/dist/cjs/util/types/PricingServiceTypes.d.ts +0 -33
  26. package/dist/cjs/util/types/SecurityServiceTypes.d.ts +0 -121
  27. package/dist/cjs/util/types/TransactionServiceTypes.d.ts +0 -388
  28. package/dist/cjs/util/types/XykServiceTypes.d.ts +0 -687
  29. package/dist/es/index.d.ts +0 -20
  30. package/dist/es/index.js +0 -8176
  31. package/dist/es/index.js.map +0 -1
  32. package/dist/es/services/BalanceService.d.ts +0 -638
  33. package/dist/es/services/BaseService.d.ts +0 -571
  34. package/dist/es/services/CovalentClient.d.ts +0 -57
  35. package/dist/es/services/NftService.d.ts +0 -686
  36. package/dist/es/services/PricingService.d.ts +0 -103
  37. package/dist/es/services/SecurityService.d.ts +0 -162
  38. package/dist/es/services/TransactionService.d.ts +0 -711
  39. package/dist/es/services/XykService.d.ts +0 -1018
  40. package/dist/es/util/ApiHelpers.d.ts +0 -6
  41. package/dist/es/util/ApiKeyValidator.d.ts +0 -8
  42. package/dist/es/util/CalculatePrettyBalance.d.ts +0 -1
  43. package/dist/es/util/Chains.d.ts +0 -223
  44. package/dist/es/util/backoff.d.ts +0 -12
  45. package/dist/es/util/prettifyCurrency.d.ts +0 -2
  46. package/dist/es/util/types/BalanceServiceTypes.d.ts +0 -378
  47. package/dist/es/util/types/BaseServiceTypes.d.ts +0 -276
  48. package/dist/es/util/types/GenericTypes.d.ts +0 -116
  49. package/dist/es/util/types/NftServiceTypes.d.ts +0 -303
  50. package/dist/es/util/types/PricingServiceTypes.d.ts +0 -33
  51. package/dist/es/util/types/SecurityServiceTypes.d.ts +0 -121
  52. package/dist/es/util/types/TransactionServiceTypes.d.ts +0 -388
  53. package/dist/es/util/types/XykServiceTypes.d.ts +0 -687
  54. package/dist/esm/index.d.ts +0 -20
  55. package/dist/esm/index.js +0 -8176
  56. package/dist/esm/index.js.map +0 -1
  57. package/dist/esm/services/BalanceService.d.ts +0 -638
  58. package/dist/esm/services/BaseService.d.ts +0 -571
  59. package/dist/esm/services/CovalentClient.d.ts +0 -57
  60. package/dist/esm/services/NftService.d.ts +0 -686
  61. package/dist/esm/services/PricingService.d.ts +0 -103
  62. package/dist/esm/services/SecurityService.d.ts +0 -162
  63. package/dist/esm/services/TransactionService.d.ts +0 -711
  64. package/dist/esm/services/XykService.d.ts +0 -1018
  65. package/dist/esm/util/ApiHelpers.d.ts +0 -6
  66. package/dist/esm/util/ApiKeyValidator.d.ts +0 -8
  67. package/dist/esm/util/CalculatePrettyBalance.d.ts +0 -1
  68. package/dist/esm/util/Chains.d.ts +0 -223
  69. package/dist/esm/util/backoff.d.ts +0 -12
  70. package/dist/esm/util/prettifyCurrency.d.ts +0 -2
  71. package/dist/esm/util/types/BalanceServiceTypes.d.ts +0 -378
  72. package/dist/esm/util/types/BaseServiceTypes.d.ts +0 -276
  73. package/dist/esm/util/types/GenericTypes.d.ts +0 -116
  74. package/dist/esm/util/types/NftServiceTypes.d.ts +0 -303
  75. package/dist/esm/util/types/PricingServiceTypes.d.ts +0 -33
  76. package/dist/esm/util/types/SecurityServiceTypes.d.ts +0 -121
  77. package/dist/esm/util/types/TransactionServiceTypes.d.ts +0 -388
  78. package/dist/esm/util/types/XykServiceTypes.d.ts +0 -687
  79. package/dist/index.d.ts +0 -20
  80. package/dist/index.js +0 -21
  81. package/dist/index.js.map +0 -1
  82. package/dist/services/BalanceService.d.ts +0 -638
  83. package/dist/services/BalanceService.js +0 -959
  84. package/dist/services/BalanceService.js.map +0 -1
  85. package/dist/services/BaseService.d.ts +0 -571
  86. package/dist/services/BaseService.js +0 -1202
  87. package/dist/services/BaseService.js.map +0 -1
  88. package/dist/services/CovalentClient.d.ts +0 -57
  89. package/dist/services/CovalentClient.js +0 -49
  90. package/dist/services/CovalentClient.js.map +0 -1
  91. package/dist/services/NftService.d.ts +0 -686
  92. package/dist/services/NftService.js +0 -1490
  93. package/dist/services/NftService.js.map +0 -1
  94. package/dist/services/PricingService.d.ts +0 -103
  95. package/dist/services/PricingService.js +0 -155
  96. package/dist/services/PricingService.js.map +0 -1
  97. package/dist/services/SecurityService.d.ts +0 -162
  98. package/dist/services/SecurityService.js +0 -249
  99. package/dist/services/SecurityService.js.map +0 -1
  100. package/dist/services/TransactionService.d.ts +0 -711
  101. package/dist/services/TransactionService.js +0 -1687
  102. package/dist/services/TransactionService.js.map +0 -1
  103. package/dist/services/XykService.d.ts +0 -1018
  104. package/dist/services/XykService.js +0 -1827
  105. package/dist/services/XykService.js.map +0 -1
  106. package/dist/util/ApiHelpers.d.ts +0 -6
  107. package/dist/util/ApiHelpers.js +0 -87
  108. package/dist/util/ApiHelpers.js.map +0 -1
  109. package/dist/util/ApiKeyValidator.d.ts +0 -8
  110. package/dist/util/ApiKeyValidator.js +0 -13
  111. package/dist/util/ApiKeyValidator.js.map +0 -1
  112. package/dist/util/CalculatePrettyBalance.d.ts +0 -1
  113. package/dist/util/CalculatePrettyBalance.js +0 -32
  114. package/dist/util/CalculatePrettyBalance.js.map +0 -1
  115. package/dist/util/Chains.d.ts +0 -223
  116. package/dist/util/Chains.js +0 -225
  117. package/dist/util/Chains.js.map +0 -1
  118. package/dist/util/backoff.d.ts +0 -12
  119. package/dist/util/backoff.js +0 -47
  120. package/dist/util/backoff.js.map +0 -1
  121. package/dist/util/prettifyCurrency.d.ts +0 -2
  122. package/dist/util/prettifyCurrency.js +0 -69
  123. package/dist/util/prettifyCurrency.js.map +0 -1
  124. package/dist/util/types/BalanceServiceTypes.d.ts +0 -378
  125. package/dist/util/types/BalanceServiceTypes.js +0 -2
  126. package/dist/util/types/BalanceServiceTypes.js.map +0 -1
  127. package/dist/util/types/BaseServiceTypes.d.ts +0 -276
  128. package/dist/util/types/BaseServiceTypes.js +0 -2
  129. package/dist/util/types/BaseServiceTypes.js.map +0 -1
  130. package/dist/util/types/GenericTypes.d.ts +0 -116
  131. package/dist/util/types/GenericTypes.js +0 -2
  132. package/dist/util/types/GenericTypes.js.map +0 -1
  133. package/dist/util/types/NftServiceTypes.d.ts +0 -303
  134. package/dist/util/types/NftServiceTypes.js +0 -2
  135. package/dist/util/types/NftServiceTypes.js.map +0 -1
  136. package/dist/util/types/PricingServiceTypes.d.ts +0 -33
  137. package/dist/util/types/PricingServiceTypes.js +0 -2
  138. package/dist/util/types/PricingServiceTypes.js.map +0 -1
  139. package/dist/util/types/SecurityServiceTypes.d.ts +0 -121
  140. package/dist/util/types/SecurityServiceTypes.js +0 -2
  141. package/dist/util/types/SecurityServiceTypes.js.map +0 -1
  142. package/dist/util/types/TransactionServiceTypes.d.ts +0 -388
  143. package/dist/util/types/TransactionServiceTypes.js +0 -2
  144. package/dist/util/types/TransactionServiceTypes.js.map +0 -1
  145. package/dist/util/types/XykServiceTypes.d.ts +0 -687
  146. package/dist/util/types/XykServiceTypes.js +0 -2
  147. package/dist/util/types/XykServiceTypes.js.map +0 -1
@@ -1,103 +0,0 @@
1
- import { Chain, ChainID, Quote, Source } from "./CovalentClient";
2
- import { Chains } from "../util/Chains";
3
- declare class TokenPricesResponse {
4
- /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
5
- contract_decimals: number;
6
- /** * The string returned by the `name()` method. */
7
- contract_name: string;
8
- /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
9
- contract_ticker_symbol: string;
10
- /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
11
- contract_address: string;
12
- /** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
13
- supports_erc: string[];
14
- /** * The contract logo URL. */
15
- logo_url: string;
16
- update_at: Date;
17
- /** * The requested quote currency eg: `USD`. */
18
- quote_currency: string;
19
- /** * The contract logo URLs. */
20
- logo_urls: LogoUrls;
21
- /** * List of response items. */
22
- prices: Price[];
23
- /** * List of response items. */
24
- items: Price[];
25
- constructor(data: TokenPricesResponse);
26
- }
27
- declare class LogoUrls {
28
- /** * The token logo URL. */
29
- token_logo_url: string;
30
- /** * The protocol logo URL. */
31
- protocol_logo_url: string;
32
- /** * The chain logo URL. */
33
- chain_logo_url: string;
34
- constructor(data: LogoUrls);
35
- }
36
- declare class Price {
37
- contract_metadata: ContractMetadata;
38
- /** * The date of the price capture. */
39
- date: Date;
40
- /** * The price in the requested `quote-currency`. */
41
- price: number;
42
- /** * A prettier version of the price for rendering purposes. */
43
- pretty_price: string;
44
- constructor(data: Price);
45
- }
46
- declare class ContractMetadata {
47
- /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
48
- contract_decimals: number;
49
- /** * The string returned by the `name()` method. */
50
- contract_name: string;
51
- /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
52
- contract_ticker_symbol: string;
53
- /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
54
- contract_address: string;
55
- /** * A list of supported standard ERC interfaces, eg: `ERC20` and `ERC721`. */
56
- supports_erc: string[];
57
- /** * The contract logo URL. */
58
- logo_url: string;
59
- constructor(data: ContractMetadata);
60
- }
61
- export interface GetTokenPricesQueryParamOpts {
62
- /** * The start day of the historical price range (YYYY-MM-DD). */
63
- from?: string;
64
- /** * The end day of the historical price range (YYYY-MM-DD). */
65
- to?: string;
66
- /** * Sort the prices in chronological ascending order. By default, it's set to `false` and returns prices in chronological descending order. */
67
- pricesAtAsc?: boolean;
68
- }
69
- /**
70
- * Pricing APIs
71
- *
72
- */
73
- export declare class Response<T> {
74
- data: Array<T>;
75
- error: boolean;
76
- error_code: number;
77
- error_message: string;
78
- }
79
- export declare class PricingService {
80
- private apiKey;
81
- private debug;
82
- private threadCount;
83
- private is_key_valid;
84
- private enableRetry;
85
- private source;
86
- private LIMIT;
87
- constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry: boolean, source: Source);
88
- /**
89
- *
90
- * Commonly used to get historic prices of a token between date ranges. Supports native tokens.
91
- *
92
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
93
- * @param {string} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
94
- * @param {string} contractAddress - Contract address for the token. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. Supports multiple contract addresses separated by commas.
95
- * @param {GetTokenPricesQueryParamOpts} queryParamOpts
96
- * - `from`: The start day of the historical price range (YYYY-MM-DD).
97
- * - `to`: The end day of the historical price range (YYYY-MM-DD).
98
- * - `pricesAtAsc`: Sort the prices in chronological ascending order. By default, it's set to `false` and returns prices in chronological descending order.
99
- *
100
- */
101
- getTokenPrices(chainName: Chain | Chains | ChainID, quoteCurrency: Quote, contractAddress: string, queryParamOpts?: GetTokenPricesQueryParamOpts): Promise<Response<TokenPricesResponse>>;
102
- }
103
- export {};
@@ -1,162 +0,0 @@
1
- import { Chain, Response, ChainID, Source } from "./CovalentClient";
2
- import { Chains } from "../util/Chains";
3
- declare class ApprovalsResponse {
4
- /** * The requested address. */
5
- address: string;
6
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
7
- updated_at: Date;
8
- /** * The requested quote currency eg: `USD`. */
9
- quote_currency: string;
10
- /** * The requested chain ID eg: `1`. */
11
- chain_id: number;
12
- /** * The requested chain name eg: `eth-mainnet`. */
13
- chain_name: string;
14
- /** * List of response items. */
15
- items: TokensApprovalItem[];
16
- constructor(data: ApprovalsResponse);
17
- }
18
- declare class TokensApprovalItem {
19
- /** * The address for the token that has approvals. */
20
- token_address: string;
21
- /** * The name for the token that has approvals. */
22
- token_address_label: string;
23
- /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
24
- ticker_symbol: string;
25
- /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
26
- contract_decimals: number;
27
- /** * The contract logo URL. */
28
- logo_url: string;
29
- /** * The exchange rate for the requested quote currency. */
30
- quote_rate: number;
31
- /** * Wallet balance of the token. */
32
- balance: bigint | null;
33
- /** * Value of the wallet balance of the token. */
34
- balance_quote: number;
35
- /** * A prettier version of the quote for rendering purposes. */
36
- pretty_balance_quote: string;
37
- /** * Total amount at risk across all spenders. */
38
- value_at_risk: string;
39
- /** * Value of total amount at risk across all spenders. */
40
- value_at_risk_quote: number;
41
- /** * A prettier version of the quote for rendering purposes. */
42
- pretty_value_at_risk_quote: string;
43
- /** * Contracts with non-zero approvals for this token. */
44
- spenders: TokenSpenderItem[];
45
- constructor(data: TokensApprovalItem);
46
- }
47
- declare class TokenSpenderItem {
48
- /** * The height of the block. */
49
- block_height: number;
50
- /** * The offset is the position of the tx in the block. */
51
- tx_offset: number;
52
- /** * The offset is the position of the log entry within an event log." */
53
- log_offset: number;
54
- /** * The block signed timestamp in UTC. */
55
- block_signed_at: Date;
56
- /** * Most recent transaction that updated approval amounts for the token. */
57
- tx_hash: string;
58
- /** * Address of the contract with approval for the token. */
59
- spender_address: string;
60
- /** * Name of the contract with approval for the token. */
61
- spender_address_label: string;
62
- /** * Remaining number of tokens granted to the spender by the approval. */
63
- allowance: string;
64
- /** * Value of the remaining allowance specified by the approval. */
65
- allowance_quote: number;
66
- /** * A prettier version of the quote for rendering purposes. */
67
- pretty_allowance_quote: string;
68
- /** * Amount at risk for spender. */
69
- value_at_risk: string;
70
- /** * Value of amount at risk for spender. */
71
- value_at_risk_quote: number;
72
- /** * A prettier version of the quote for rendering purposes. */
73
- pretty_value_at_risk_quote: string;
74
- risk_factor: string;
75
- constructor(data: TokenSpenderItem);
76
- }
77
- declare class NftApprovalsResponse {
78
- /** * The timestamp when the response was generated. Useful to show data staleness to users. */
79
- updated_at: Date;
80
- /** * The requested chain ID eg: `1`. */
81
- chain_id: number;
82
- /** * The requested chain name eg: `eth-mainnet`. */
83
- chain_name: string;
84
- /** * The requested address. */
85
- address: string;
86
- /** * List of response items. */
87
- items: NftApprovalsItem[];
88
- constructor(data: NftApprovalsResponse);
89
- }
90
- declare class NftApprovalsItem {
91
- /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
92
- contract_address: string;
93
- /** * The label of the contract address. */
94
- contract_address_label: string;
95
- /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
96
- contract_ticker_symbol: string;
97
- /** * List of asset balances held by the user. */
98
- token_balances: NftApprovalBalance[];
99
- /** * Contracts with non-zero approvals for this token. */
100
- spenders: NftApprovalSpender[];
101
- constructor(data: NftApprovalsItem);
102
- }
103
- declare class NftApprovalBalance {
104
- /** * The token's id. */
105
- token_id: bigint | null;
106
- /** * The NFT's token balance. */
107
- token_balance: bigint | null;
108
- constructor(data: NftApprovalBalance);
109
- }
110
- declare class NftApprovalSpender {
111
- /** * The height of the block. */
112
- block_height: number;
113
- /** * The offset is the position of the tx in the block. */
114
- tx_offset: number;
115
- /** * The offset is the position of the log entry within an event log." */
116
- log_offset: number;
117
- /** * The block signed timestamp in UTC. */
118
- block_signed_at: Date;
119
- /** * Most recent transaction that updated approval amounts for the token. */
120
- tx_hash: string;
121
- /** * Address of the contract with approval for the token. */
122
- spender_address: string;
123
- /** * Name of the contract with approval for the token. */
124
- spender_address_label: string;
125
- /** * The token ids approved. */
126
- token_ids_approved: string;
127
- /** * Remaining number of tokens granted to the spender by the approval. */
128
- allowance: string;
129
- constructor(data: NftApprovalSpender);
130
- }
131
- /**
132
- * Approvals API
133
- *
134
- */
135
- export declare class SecurityService {
136
- private apiKey;
137
- private debug;
138
- private threadCount;
139
- private is_key_valid;
140
- private enableRetry;
141
- private source;
142
- private LIMIT;
143
- constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry: boolean, source: Source);
144
- /**
145
- *
146
- * Commonly used to get a list of approvals across all token contracts categorized by spenders for a wallet’s assets.
147
- *
148
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
149
- * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
150
- *
151
- */
152
- getApprovals(chainName: Chain | Chains | ChainID, walletAddress: string): Promise<Response<ApprovalsResponse>>;
153
- /**
154
- *
155
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
156
- * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
157
-
158
- *
159
- */
160
- getNftApprovals(chainName: Chain | Chains | ChainID, walletAddress: string): Promise<Response<NftApprovalsResponse>>;
161
- }
162
- export {};