@covalenthq/client-sdk 3.0.3 → 3.0.5
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 +12 -9
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/src/utils/types/StreamingService.types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<a href="https://www.npmjs.com/package/@covalenthq/client-sdk">
|
|
14
14
|
<img src="https://img.shields.io/npm/dm/@covalenthq/client-sdk" alt="NPM downloads">
|
|
15
15
|
</a>
|
|
16
|
-
<img src="https://img.shields.io/github/license/covalenthq/
|
|
16
|
+
<img src="https://img.shields.io/github/license/covalenthq/goldrush-services-monorepo" alt="Apache-2.0">
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
19
|
# GoldRush SDK for TypeScript
|
|
@@ -63,8 +63,8 @@ The GoldRush SDK is the fastest way to integrate the GoldRush API for working wi
|
|
|
63
63
|
2. **threadCount**: A number that sets the number of concurrent requests allowed. It is set as `2` by default.
|
|
64
64
|
3. **enableRetry**: A boolean that enables retrying the API endpoint in case of a `429 - rate limit` error. It is set as `true` by default.
|
|
65
65
|
4. **maxRetries**: A number that sets the number of retries to be made in case of `429 - rate limit` error. To be in effect, it requires `enableRetry` to be enabled. It is set as `2` by default.
|
|
66
|
-
5. **retryDelay**: A number that sets the delay in `ms` for retrying the API endpoint in case of `429 - rate limit` error. To be in effect, it requires `enableRetry` to be enabled. It is set as `
|
|
67
|
-
6. **source**: A string that defines the `source` of the request
|
|
66
|
+
5. **retryDelay**: A number that sets the delay in `ms` for retrying the API endpoint in case of `429 - rate limit` error. To be in effect, it requires `enableRetry` to be enabled. It is set as `1500` by default.
|
|
67
|
+
6. **source**: A string that defines the `source` of the request for better analytics. Predefined values include `"Ponder"`, `"GoldRush"`, and `"Viem"`, but any custom string is accepted.
|
|
68
68
|
|
|
69
69
|
The `streamingConfig` is optional and configures the real-time streaming service. The available options are:
|
|
70
70
|
1. **shouldRetry**: A function that determines whether to retry connection based on retry count. Defaults to retry up to 5 times.
|
|
@@ -139,7 +139,7 @@ The SDK supports the following formats for the chain input:
|
|
|
139
139
|
|
|
140
140
|
### 5. Additional Non-Paginated methods
|
|
141
141
|
|
|
142
|
-
For paginated responses, the GoldRush API can at max support 100 items per page. However, the
|
|
142
|
+
For paginated responses, the GoldRush API can at max support 100 items per page. However, the GoldRush SDK leverages generators to _seamlessly fetch all items without the user having to deal with pagination_.
|
|
143
143
|
|
|
144
144
|
For example, the following fetches ALL transactions for `0xfc43f5f9dd45258b3aff31bdbe6561d97e8b71de` on Ethereum:
|
|
145
145
|
|
|
@@ -211,7 +211,7 @@ if (resp.data !== null) {
|
|
|
211
211
|
prettifyCurrency(89.0, 2, "CAD"); // "CA$89.00"
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
-
You can explore more examples [here](./test/unit/
|
|
214
|
+
You can explore more examples [here](./test/unit/prettify-currency.test.ts)
|
|
215
215
|
|
|
216
216
|
5. **timestampParser**: Convert ISO timestamps to various human-readable formats
|
|
217
217
|
|
|
@@ -448,7 +448,7 @@ All the responses are of the same standardized format
|
|
|
448
448
|
|
|
449
449
|
## Supported Endpoints
|
|
450
450
|
|
|
451
|
-
The
|
|
451
|
+
The GoldRush SDK provides comprehensive support for all Class A, Class B, and Pricing endpoints that are grouped under the following _Service_ namespaces:
|
|
452
452
|
|
|
453
453
|
<details>
|
|
454
454
|
<summary>
|
|
@@ -497,7 +497,7 @@ The Covalent SDK provides comprehensive support for all Class A, Class B, and Pr
|
|
|
497
497
|
- `getLogEventsByAddressByPage(chainName: Chain, contractAddress: string, queryParamOpts?: GetLogEventsByAddressQueryParamOpts): Promise<GoldRushResponse<LogEventsByAddressResponse>>`: Commonly used to get all the event logs emitted from a particular contract address. Useful for building dashboards that examine on-chain interactions. (Nonpaginated)
|
|
498
498
|
- `getLogEventsByTopicHash(chainName: Chain, topicHash: string, queryParamOpts?: GetLogEventsByTopicHashQueryParamOpts): AsyncIterable<GoldRushResponse<LogEventsByTopicHashResponse>>`: Commonly used to get all event logs of the same topic hash across all contracts within a particular chain. Useful for cross-sectional analysis of event logs that are emitted on-chain. (Paginated)
|
|
499
499
|
- `getLogEventsByTopicHashByPage(chainName: Chain, topicHash: string, queryParamOpts?: GetLogEventsByTopicHashQueryParamOpts): Promise<GoldRushResponse<LogEventsByTopicHashResponse>>`: Commonly used to get all event logs of the same topic hash across all contracts within a particular chain. Useful for cross-sectional analysis of event logs that are emitted on-chain. (Nonpaginated)
|
|
500
|
-
- `getAllChains(): Promise<GoldRushResponse<AllChainsResponse>>`: Commonly used to build internal dashboards for all supported chains on
|
|
500
|
+
- `getAllChains(): Promise<GoldRushResponse<AllChainsResponse>>`: Commonly used to build internal dashboards for all supported chains on GoldRush.
|
|
501
501
|
- `getAllChainStatus(): Promise<GoldRushResponse<AllChainStatusResponse>>`: Commonly used to build internal status dashboards of all supported chains.
|
|
502
502
|
- `getGasPrices(chainName: Chain, eventType: "erc20" | "nativetokens" | "uniswapv3", queryParamOpts?: GetGasPricesQueryParamOpts): Promise<GoldRushResponse<GasPricesResponse>>`: Get real-time gas estimates for different transaction speeds on a specific network, enabling users to optimize transaction costs and confirmation times.
|
|
503
503
|
</details>
|
|
@@ -560,6 +560,9 @@ The Covalent SDK provides comprehensive support for all Class A, Class B, and Pr
|
|
|
560
560
|
- `subscribeToNewPairs(params: NewPairsStreamParams, callbacks: StreamSubscriptionOptions<NewPairsStreamResponse[]>): UnsubscribeFunction`: Subscribe to real-time notifications when new liquidity pairs are created on supported decentralized exchanges (DEXes). Supports Uniswap V2/V3 across Base, Ethereum, and BSC networks.
|
|
561
561
|
- `subscribeToUpdatePairs(params: UpdatePairsStreamParams, callbacks: StreamSubscriptionOptions<UpdatePairsStreamResponse>): UnsubscribeFunction`: Subscribe to real-time updates for specific trading pairs including quote rate, volume, liquidity data, price deltas, and swap counts.
|
|
562
562
|
- `rawQuery<T = Array<object>>(query: string, variables: Record<string, unknown>, callbacks: StreamSubscriptionOptions<T>): UnsubscribeFunction`: Execute custom GraphQL subscription queries for advanced streaming scenarios and future extensibility.
|
|
563
|
+
- `searchToken(params: TokenSearchParams): Promise<TokenSearchResponse[]>`: Search for tokens by keyword, ticker, or contract address. Optionally filter by chain.
|
|
564
|
+
- `getUPnLForToken(params: UPnLForTokenParams): Promise<UPnLForTokenResponse[]>`: Get top trader wallets and their realized/unrealized PnL for a specific token.
|
|
565
|
+
- `getUPnLForWallet(params: UPnLForWalletParams): Promise<UPnLForWalletResponse[]>`: Get realized and unrealized PnL for all tokens held by a wallet.
|
|
563
566
|
- `disconnect(): Promise<void>`: Properly disconnect from the streaming service.
|
|
564
567
|
|
|
565
568
|
</details>
|
|
@@ -567,7 +570,7 @@ The Covalent SDK provides comprehensive support for all Class A, Class B, and Pr
|
|
|
567
570
|
## Contributing
|
|
568
571
|
|
|
569
572
|
Contributions, issues and feature requests are welcome!
|
|
570
|
-
Feel free to check [issues](https://github.com/covalenthq/
|
|
573
|
+
Feel free to check [issues](https://github.com/covalenthq/goldrush-services-monorepo/issues) page.
|
|
571
574
|
|
|
572
575
|
## Show your support
|
|
573
576
|
|
|
@@ -575,4 +578,4 @@ Give a ⭐️ if this project helped you!
|
|
|
575
578
|
|
|
576
579
|
## License
|
|
577
580
|
|
|
578
|
-
This project is [
|
|
581
|
+
This project is [Apache-2.0](./LICENSE) licensed.
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = "3.0.
|
|
3
|
+
var version = "3.0.5";
|
|
4
4
|
|
|
5
5
|
const bigIntParser = (val) => {
|
|
6
6
|
if (val === null || val === undefined) {
|
|
@@ -3097,8 +3097,8 @@ class StreamingService {
|
|
|
3097
3097
|
*/
|
|
3098
3098
|
searchToken(params) {
|
|
3099
3099
|
const query = `
|
|
3100
|
-
query SearchToken($query: String
|
|
3101
|
-
searchToken(query: $query) {
|
|
3100
|
+
query SearchToken($query: String!, $chain_name: ChainName) {
|
|
3101
|
+
searchToken(query: $query, chain_name: $chain_name) {
|
|
3102
3102
|
pair_address
|
|
3103
3103
|
chain_name
|
|
3104
3104
|
quote_rate
|
|
@@ -3126,7 +3126,10 @@ class StreamingService {
|
|
|
3126
3126
|
let result = [];
|
|
3127
3127
|
client.subscribe({
|
|
3128
3128
|
query,
|
|
3129
|
-
variables: {
|
|
3129
|
+
variables: {
|
|
3130
|
+
query: params.query,
|
|
3131
|
+
chain_name: params.chain_name,
|
|
3132
|
+
},
|
|
3130
3133
|
}, {
|
|
3131
3134
|
next: (data) => {
|
|
3132
3135
|
if (data.data) {
|
|
@@ -3290,7 +3293,7 @@ class StreamingWebSocketClient {
|
|
|
3290
3293
|
if (StreamingWebSocketClient.client)
|
|
3291
3294
|
return;
|
|
3292
3295
|
StreamingWebSocketClient.client = createClient({
|
|
3293
|
-
url: "wss://
|
|
3296
|
+
url: "wss://streaming.goldrushdata.com/graphql",
|
|
3294
3297
|
lazyCloseTimeout: 3000,
|
|
3295
3298
|
connectionParams: {
|
|
3296
3299
|
GOLDRUSH_API_KEY: StreamingWebSocketClient.apiKey,
|