@covalenthq/client-sdk 2.2.5 → 2.3.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.
- package/README.md +595 -356
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1303 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/GoldRushClient.d.ts +4 -1
- package/dist/cjs/src/services/PricingService.d.ts +13 -2
- package/dist/cjs/src/services/StreamingService.d.ts +151 -0
- package/dist/cjs/src/utils/types/PricingService.types.d.ts +40 -0
- package/dist/cjs/src/utils/types/StreamingService.types.d.ts +201 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1304 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/GoldRushClient.d.ts +4 -1
- package/dist/esm/src/services/PricingService.d.ts +13 -2
- package/dist/esm/src/services/StreamingService.d.ts +151 -0
- package/dist/esm/src/utils/types/PricingService.types.d.ts +40 -0
- package/dist/esm/src/utils/types/StreamingService.types.d.ts +201 -0
- package/package.json +76 -74
|
@@ -5,8 +5,10 @@ import { BitcoinService } from "./services/BitcoinService";
|
|
|
5
5
|
import { NftService } from "./services/NftService";
|
|
6
6
|
import { PricingService } from "./services/PricingService";
|
|
7
7
|
import { SecurityService } from "./services/SecurityService";
|
|
8
|
+
import { StreamingService } from "./services/StreamingService";
|
|
8
9
|
import { TransactionService } from "./services/TransactionService";
|
|
9
10
|
import { type GoldRushClientSettings } from "./utils/types/Generic.types";
|
|
11
|
+
import { type StreamingServiceConfig } from "./utils/types/StreamingService.types";
|
|
10
12
|
/**
|
|
11
13
|
* GoldRushClient Class
|
|
12
14
|
*/
|
|
@@ -19,6 +21,7 @@ export declare class GoldRushClient {
|
|
|
19
21
|
NftService: NftService;
|
|
20
22
|
PricingService: PricingService;
|
|
21
23
|
SecurityService: SecurityService;
|
|
24
|
+
StreamingService: StreamingService;
|
|
22
25
|
TransactionService: TransactionService;
|
|
23
|
-
constructor(apiKey: string, settings?: GoldRushClientSettings);
|
|
26
|
+
constructor(apiKey: string, settings?: GoldRushClientSettings, streamingConfig?: StreamingServiceConfig);
|
|
24
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Execution } from "../utils/functions/execution";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { Chain, GoldRushResponse, Quote } from "../utils/types/Generic.types";
|
|
3
|
+
import type { GetTokenPricesQueryParamOpts, PoolSpotPriceQueryParamsOpts, PoolSpotPricesResponse, TokenPricesResponse } from "../utils/types/PricingService.types";
|
|
4
4
|
/**
|
|
5
5
|
* Pricing API
|
|
6
6
|
*
|
|
@@ -22,4 +22,15 @@ export declare class PricingService {
|
|
|
22
22
|
*
|
|
23
23
|
*/
|
|
24
24
|
getTokenPrices(chainName: Chain, quoteCurrency: Quote, contractAddress: string, queryParamOpts?: GetTokenPricesQueryParamOpts): Promise<GoldRushResponse<TokenPricesResponse[]>>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* Get the spot token pair prices for a specified pool contract address. Supports pools on Uniswap V2, V3 and their forks.
|
|
28
|
+
*
|
|
29
|
+
* @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
|
|
30
|
+
* @param {string} contractAddress - The pool contract address.
|
|
31
|
+
* @param {GetTokenPricesQueryParamOpts} queryParamOpts
|
|
32
|
+
* - `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
|
+
getPoolSpotPrices(chainName: Chain, contractAddress: string, queryParamOpts?: PoolSpotPriceQueryParamsOpts): Promise<GoldRushResponse<PoolSpotPricesResponse[]>>;
|
|
25
36
|
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { type NewPairsStreamParams, type NewPairsStreamResponse, type OHLCVPairsStreamParams, type OHLCVPairsStreamResponse, type OHLCVTokensStreamParams, type OHLCVTokensStreamResponse, type StreamingServiceConfig, type StreamSubscriptionOptions, type TokenBalancesStreamParams, type TokenBalancesStreamResponse, type UnsubscribeFunction, type WalletActivityStreamParams, type WalletActivityStreamResponse } from "../utils/types/StreamingService.types";
|
|
2
|
+
import { type Client } from "graphql-ws";
|
|
3
|
+
/**
|
|
4
|
+
* Streaming API Service
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare class StreamingService {
|
|
8
|
+
private defaultConfig;
|
|
9
|
+
constructor(apiKey: string, config?: StreamingServiceConfig);
|
|
10
|
+
/**
|
|
11
|
+
* Initialize the streaming connection
|
|
12
|
+
*/
|
|
13
|
+
getClient(): Client;
|
|
14
|
+
/**
|
|
15
|
+
* Disconnect from the streaming service
|
|
16
|
+
*/
|
|
17
|
+
disconnect(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Check if the client is connected
|
|
20
|
+
*/
|
|
21
|
+
get isConnected(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Subscribe to a custom GraphQL subscription
|
|
24
|
+
* This allows for advanced usage and future extensibility
|
|
25
|
+
*
|
|
26
|
+
* @param query - GraphQL subscription query
|
|
27
|
+
* @param variables - Query variables
|
|
28
|
+
* @param callbacks - Subscription callbacks
|
|
29
|
+
* @returns Unsubscribe function
|
|
30
|
+
*/
|
|
31
|
+
rawQuery<T = Array<object>>(query: string, variables: Record<string, unknown>, callbacks: StreamSubscriptionOptions<T>): UnsubscribeFunction;
|
|
32
|
+
/**
|
|
33
|
+
* Subscribe to OHLCV data for specific pairs
|
|
34
|
+
*
|
|
35
|
+
* @param params - Parameters for the OHLCV pairs stream
|
|
36
|
+
* @param callbacks - Subscription callbacks
|
|
37
|
+
* @returns Unsubscribe function
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const unsubscribe = streamingService.subscribeToOHLCVPairs(
|
|
42
|
+
* {
|
|
43
|
+
* chain_name: StreamingChain.BASE_MAINNET,
|
|
44
|
+
* pair_addresses: ["0x9c087Eb773291e50CF6c6a90ef0F4500e349B903"],
|
|
45
|
+
* interval: StreamingInterval.ONE_MINUTE,
|
|
46
|
+
* timeframe: StreamingTimeframe.ONE_HOUR
|
|
47
|
+
* },
|
|
48
|
+
* {
|
|
49
|
+
* next: (data) => console.log("OHLCV Data:", data),
|
|
50
|
+
* error: (err) => console.error("Error:", err),
|
|
51
|
+
* complete: () => console.log("Stream completed")
|
|
52
|
+
* }
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
subscribeToOHLCVPairs(params: OHLCVPairsStreamParams, callbacks: StreamSubscriptionOptions<OHLCVPairsStreamResponse[]>): UnsubscribeFunction;
|
|
57
|
+
/**
|
|
58
|
+
* Subscribe to OHLCV data for specific tokens
|
|
59
|
+
*
|
|
60
|
+
* @param params - Parameters for the OHLCV tokens stream
|
|
61
|
+
* @param callbacks - Subscription callbacks
|
|
62
|
+
* @returns Unsubscribe function
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const unsubscribe = streamingService.subscribeToOHLCVTokens(
|
|
67
|
+
* {
|
|
68
|
+
* chain_name: StreamingChain.BASE_MAINNET,
|
|
69
|
+
* token_addresses: ["0x4B6104755AfB5Da4581B81C552DA3A25608c73B8"],
|
|
70
|
+
* interval: StreamingInterval.ONE_MINUTE,
|
|
71
|
+
* timeframe: StreamingTimeframe.ONE_HOUR
|
|
72
|
+
* },
|
|
73
|
+
* {
|
|
74
|
+
* next: (data) => console.log("OHLCV Token Data:", data),
|
|
75
|
+
* error: (err) => console.error("Error:", err),
|
|
76
|
+
* complete: () => console.log("Stream completed")
|
|
77
|
+
* }
|
|
78
|
+
* );
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
subscribeToOHLCVTokens(params: OHLCVTokensStreamParams, callbacks: StreamSubscriptionOptions<OHLCVTokensStreamResponse[]>): UnsubscribeFunction;
|
|
82
|
+
/**
|
|
83
|
+
* Subscribe to new DEX pairs created on supported decentralized exchanges
|
|
84
|
+
*
|
|
85
|
+
* @param params - Parameters for the new pairs stream
|
|
86
|
+
* @param callbacks - Subscription callbacks
|
|
87
|
+
* @returns Unsubscribe function
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const unsubscribe = streamingService.subscribeToNewPairs(
|
|
92
|
+
* {
|
|
93
|
+
* chain_name: StreamingChain.BASE_MAINNET,
|
|
94
|
+
* protocols: [StreamingProtocol.UNISWAP_V2, StreamingProtocol.UNISWAP_V3]
|
|
95
|
+
* },
|
|
96
|
+
* {
|
|
97
|
+
* next: (data) => console.log("New Pairs:", data),
|
|
98
|
+
* error: (err) => console.error("Error:", err),
|
|
99
|
+
* complete: () => console.log("Stream completed")
|
|
100
|
+
* }
|
|
101
|
+
* );
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
subscribeToNewPairs(params: NewPairsStreamParams, callbacks: StreamSubscriptionOptions<NewPairsStreamResponse[]>): UnsubscribeFunction;
|
|
105
|
+
/**
|
|
106
|
+
* Subscribe to real-time token balance updates for a specific wallet address
|
|
107
|
+
*
|
|
108
|
+
* @param params - Parameters for the token balances stream
|
|
109
|
+
* @param callbacks - Subscription callbacks
|
|
110
|
+
* @returns Unsubscribe function
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const unsubscribe = streamingService.subscribeToTokenBalances(
|
|
115
|
+
* {
|
|
116
|
+
* chain_name: StreamingChain.BASE_MAINNET,
|
|
117
|
+
* wallet_address: "0x198ef79f1f515f02dfe9e3115ed9fc07183f02fc"
|
|
118
|
+
* },
|
|
119
|
+
* {
|
|
120
|
+
* next: (data) => console.log("Token Balances:", data),
|
|
121
|
+
* error: (err) => console.error("Error:", err),
|
|
122
|
+
* complete: () => console.log("Stream completed")
|
|
123
|
+
* }
|
|
124
|
+
* );
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
subscribeToTokenBalances(params: TokenBalancesStreamParams, callbacks: StreamSubscriptionOptions<TokenBalancesStreamResponse>): UnsubscribeFunction;
|
|
128
|
+
/**
|
|
129
|
+
* Subscribe to real-time wallet activity including transactions, token transfers, and smart contract interactions
|
|
130
|
+
*
|
|
131
|
+
* @param params - Parameters for the wallet activity stream
|
|
132
|
+
* @param callbacks - Subscription callbacks
|
|
133
|
+
* @returns Unsubscribe function
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const unsubscribe = streamingService.subscribeToWalletActivity(
|
|
138
|
+
* {
|
|
139
|
+
* chain_name: StreamingChain.BASE_MAINNET,
|
|
140
|
+
* wallet_addresses: ["0x198ef79f1f515f02dfe9e3115ed9fc07183f02fc"]
|
|
141
|
+
* },
|
|
142
|
+
* {
|
|
143
|
+
* next: (data) => console.log("Wallet Activity:", data),
|
|
144
|
+
* error: (err) => console.error("Error:", err),
|
|
145
|
+
* complete: () => console.log("Stream completed")
|
|
146
|
+
* }
|
|
147
|
+
* );
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
subscribeToWalletActivity(params: WalletActivityStreamParams, callbacks: StreamSubscriptionOptions<WalletActivityStreamResponse[]>): UnsubscribeFunction;
|
|
151
|
+
}
|
|
@@ -38,3 +38,43 @@ export type GetTokenPricesQueryParamOpts = Nullable<{
|
|
|
38
38
|
/** * Sort the prices in chronological ascending order. By default, it's set to `false` and returns prices in chronological descending order. */
|
|
39
39
|
pricesAtAsc?: boolean;
|
|
40
40
|
}>;
|
|
41
|
+
export type PoolSpotPriceQueryParamsOpts = Nullable<{
|
|
42
|
+
/** * The currency to convert. */
|
|
43
|
+
quoteCurrency: string;
|
|
44
|
+
}>;
|
|
45
|
+
export type PoolSpotPricesResponse = Nullable<{
|
|
46
|
+
/** * The timestamp when the response was generated. */
|
|
47
|
+
updated_at: Date;
|
|
48
|
+
/** * The pool contract address. */
|
|
49
|
+
pool_address: string;
|
|
50
|
+
/** * The contract address of token_0 in the token pair making up the pool. */
|
|
51
|
+
token_0_address: string;
|
|
52
|
+
/** * The contract name of token_0 in the token pair making up the pool. */
|
|
53
|
+
token_0_name: string;
|
|
54
|
+
/** * The contract symbol of token_0 in the token pair making up the pool. */
|
|
55
|
+
token_0_ticker: string;
|
|
56
|
+
/** * Price of token_0 in units of token_1. */
|
|
57
|
+
token_0_price: string;
|
|
58
|
+
/** * Price of token_0 in units of token_1 as of 24 hours ago. */
|
|
59
|
+
token_0_price_24h: string;
|
|
60
|
+
/** * Price of token_0 in the selected quote currency (defaults to USD). */
|
|
61
|
+
token_0_price_quote: string;
|
|
62
|
+
/** * Price of token_0 in the selected quote currency (defaults to USD) as of 24 hours ago. */
|
|
63
|
+
token_0_price_24h_quote: string;
|
|
64
|
+
/** * The contract address of token_1 in the token pair making up the pool. */
|
|
65
|
+
token_1_address: string;
|
|
66
|
+
/** * The contract name of token_1 in the token pair making up the pool. */
|
|
67
|
+
token_1_name: string;
|
|
68
|
+
/** * The contract symbol of token_1 in the token pair making up the pool. */
|
|
69
|
+
token_1_ticker: string;
|
|
70
|
+
/** * Price of token_1 in units of token_0. */
|
|
71
|
+
token_1_price: string;
|
|
72
|
+
/** * Price of token_1 in units of token_0 as of 24 hours ago. */
|
|
73
|
+
token_1_price_24h: string;
|
|
74
|
+
/** * Price of token_1 in the selected quote currency (defaults to USD). */
|
|
75
|
+
token_1_price_quote: string;
|
|
76
|
+
/** * Price of token_1 in the selected quote currency (defaults to USD) as of 24 hours ago. */
|
|
77
|
+
token_1_price_24h_quote: string;
|
|
78
|
+
/** * The currency to convert. */
|
|
79
|
+
quote_currency: string;
|
|
80
|
+
}>;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import type { ContractMetadata } from "./Generic.types";
|
|
2
|
+
/**
|
|
3
|
+
* Common enums and types for Streaming API
|
|
4
|
+
*/
|
|
5
|
+
export declare enum StreamingChain {
|
|
6
|
+
BASE_MAINNET = "BASE_MAINNET",
|
|
7
|
+
ETH_MAINNET = "ETH_MAINNET",
|
|
8
|
+
BSC_MAINNET = "BSC_MAINNET"
|
|
9
|
+
}
|
|
10
|
+
export declare enum StreamingInterval {
|
|
11
|
+
FIFTEEN_SECONDS = "FIFTEEN_SECONDS",
|
|
12
|
+
THIRTY_SECONDS = "THIRTY_SECONDS",
|
|
13
|
+
ONE_MINUTE = "ONE_MINUTE",
|
|
14
|
+
FIVE_MINUTES = "FIVE_MINUTES",
|
|
15
|
+
FIFTEEN_MINUTES = "FIFTEEN_MINUTES",
|
|
16
|
+
THIRTY_MINUTES = "THIRTY_MINUTES",
|
|
17
|
+
ONE_HOUR = "ONE_HOUR",
|
|
18
|
+
FOUR_HOURS = "FOUR_HOURS",
|
|
19
|
+
ONE_DAY = "ONE_DAY"
|
|
20
|
+
}
|
|
21
|
+
export declare enum StreamingTimeframe {
|
|
22
|
+
ONE_MINUTE = "ONE_MINUTE",
|
|
23
|
+
FIVE_MINUTES = "FIVE_MINUTES",
|
|
24
|
+
FIFTEEN_MINUTES = "FIFTEEN_MINUTES",
|
|
25
|
+
THIRTY_MINUTES = "THIRTY_MINUTES",
|
|
26
|
+
ONE_HOUR = "ONE_HOUR",
|
|
27
|
+
FOUR_HOURS = "FOUR_HOURS",
|
|
28
|
+
ONE_DAY = "ONE_DAY",
|
|
29
|
+
ONE_WEEK = "ONE_WEEK",
|
|
30
|
+
ONE_MONTH = "ONE_MONTH"
|
|
31
|
+
}
|
|
32
|
+
export declare enum StreamingProtocol {
|
|
33
|
+
UNISWAP_V2 = "UNISWAP_V2",
|
|
34
|
+
UNISWAP_V3 = "UNISWAP_V3"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* OHLCV Pairs Stream Types
|
|
38
|
+
*/
|
|
39
|
+
export interface OHLCVPairsStreamParams {
|
|
40
|
+
chain_name: StreamingChain;
|
|
41
|
+
pair_addresses: string[];
|
|
42
|
+
interval: StreamingInterval;
|
|
43
|
+
timeframe: StreamingTimeframe;
|
|
44
|
+
limit?: number;
|
|
45
|
+
}
|
|
46
|
+
export interface OHLCVPairsStreamResponse {
|
|
47
|
+
chain_name: StreamingChain;
|
|
48
|
+
pair_address: string;
|
|
49
|
+
interval: StreamingInterval;
|
|
50
|
+
timeframe: StreamingTimeframe;
|
|
51
|
+
timestamp: string;
|
|
52
|
+
open: number;
|
|
53
|
+
high: number;
|
|
54
|
+
low: number;
|
|
55
|
+
close: number;
|
|
56
|
+
volume: number;
|
|
57
|
+
price_usd: number;
|
|
58
|
+
volume_usd: number;
|
|
59
|
+
base_token: ContractMetadata;
|
|
60
|
+
quote_token: ContractMetadata;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* OHLCV Tokens Stream Types
|
|
64
|
+
*/
|
|
65
|
+
export interface OHLCVTokensStreamParams {
|
|
66
|
+
chain_name: StreamingChain;
|
|
67
|
+
token_addresses: string[];
|
|
68
|
+
interval: StreamingInterval;
|
|
69
|
+
timeframe: StreamingTimeframe;
|
|
70
|
+
limit?: number;
|
|
71
|
+
}
|
|
72
|
+
export interface OHLCVTokensStreamResponse {
|
|
73
|
+
chain_name: StreamingChain;
|
|
74
|
+
pair_address: string;
|
|
75
|
+
interval: StreamingInterval;
|
|
76
|
+
timeframe: StreamingTimeframe;
|
|
77
|
+
timestamp: string;
|
|
78
|
+
open: number;
|
|
79
|
+
high: number;
|
|
80
|
+
low: number;
|
|
81
|
+
close: number;
|
|
82
|
+
volume: number;
|
|
83
|
+
volume_usd: number;
|
|
84
|
+
quote_rate: number;
|
|
85
|
+
quote_rate_usd: number;
|
|
86
|
+
base_token: ContractMetadata;
|
|
87
|
+
quote_token: ContractMetadata;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* New DEX Pairs Stream Types
|
|
91
|
+
*/
|
|
92
|
+
export interface NewPairsStreamParams {
|
|
93
|
+
chain_name: StreamingChain;
|
|
94
|
+
protocols: StreamingProtocol[];
|
|
95
|
+
}
|
|
96
|
+
export interface PriceMetrics {
|
|
97
|
+
last_5m: number;
|
|
98
|
+
last_1hr: number;
|
|
99
|
+
last_6hr: number;
|
|
100
|
+
last_24hr: number;
|
|
101
|
+
}
|
|
102
|
+
export interface SwapMetrics {
|
|
103
|
+
last_5m: number;
|
|
104
|
+
last_1hr: number;
|
|
105
|
+
last_6hr: number;
|
|
106
|
+
last_24hr: number;
|
|
107
|
+
}
|
|
108
|
+
export interface NewPairsStreamResponse {
|
|
109
|
+
chain_name: string;
|
|
110
|
+
protocol: string;
|
|
111
|
+
protocol_version: string;
|
|
112
|
+
pair_address: string;
|
|
113
|
+
deployer_address: string;
|
|
114
|
+
tx_hash: string;
|
|
115
|
+
block_signed_at: string;
|
|
116
|
+
liquidity: number;
|
|
117
|
+
supply: number;
|
|
118
|
+
market_cap: number;
|
|
119
|
+
event_name: string;
|
|
120
|
+
quote_rate: number;
|
|
121
|
+
quote_rate_usd: number;
|
|
122
|
+
base_token_metadata: ContractMetadata;
|
|
123
|
+
quote_token_metadata: ContractMetadata;
|
|
124
|
+
pair_metadata: ContractMetadata;
|
|
125
|
+
prices: PriceMetrics;
|
|
126
|
+
swaps: SwapMetrics;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Token Balances Stream Types
|
|
130
|
+
*/
|
|
131
|
+
export interface TokenBalancesStreamParams {
|
|
132
|
+
chain_name: StreamingChain;
|
|
133
|
+
wallet_address: string;
|
|
134
|
+
}
|
|
135
|
+
export interface TokenBalanceItem {
|
|
136
|
+
balance: string;
|
|
137
|
+
balance_pretty: number;
|
|
138
|
+
quote_rate_usd: number;
|
|
139
|
+
quote_usd: number;
|
|
140
|
+
metadata: ContractMetadata;
|
|
141
|
+
is_native: boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface TokenBalancesStreamResponse {
|
|
144
|
+
wallet_address: string;
|
|
145
|
+
chain_name: string;
|
|
146
|
+
last_block: number;
|
|
147
|
+
items: TokenBalanceItem[];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Wallet Activity Stream Types
|
|
151
|
+
*/
|
|
152
|
+
export interface WalletActivityStreamParams {
|
|
153
|
+
chain_name: StreamingChain;
|
|
154
|
+
wallet_addresses: string[];
|
|
155
|
+
}
|
|
156
|
+
export interface WalletActivityLogItem {
|
|
157
|
+
emitter_address: string;
|
|
158
|
+
log_offset: number;
|
|
159
|
+
data: string;
|
|
160
|
+
topics: string[];
|
|
161
|
+
}
|
|
162
|
+
export interface WalletActivityStreamResponse {
|
|
163
|
+
tx_hash: string;
|
|
164
|
+
from_address: string;
|
|
165
|
+
to_address: string;
|
|
166
|
+
value: number;
|
|
167
|
+
chain_name: string;
|
|
168
|
+
block_signed_at: string;
|
|
169
|
+
block_height: number;
|
|
170
|
+
block_hash: string;
|
|
171
|
+
miner_address: string;
|
|
172
|
+
gas_used: number;
|
|
173
|
+
tx_offset: number;
|
|
174
|
+
successful: boolean;
|
|
175
|
+
decoded_type: string;
|
|
176
|
+
decoded_details?: object;
|
|
177
|
+
logs: WalletActivityLogItem[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Streaming service configuration
|
|
181
|
+
*/
|
|
182
|
+
export interface StreamingServiceConfig {
|
|
183
|
+
shouldRetry?: (retries: number) => boolean;
|
|
184
|
+
maxReconnectAttempts?: number;
|
|
185
|
+
onConnecting?: () => void;
|
|
186
|
+
onOpened?: () => void;
|
|
187
|
+
onClosed?: () => void;
|
|
188
|
+
onError?: (error: any) => void;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Stream subscription options
|
|
192
|
+
*/
|
|
193
|
+
export interface StreamSubscriptionOptions<T = Array<object>> {
|
|
194
|
+
next: (payload: T) => void;
|
|
195
|
+
error?: (error: any) => void;
|
|
196
|
+
complete?: () => void;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Unsubscribe function type
|
|
200
|
+
*/
|
|
201
|
+
export type UnsubscribeFunction = () => void;
|
package/package.json
CHANGED
|
@@ -1,74 +1,76 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@covalenthq/client-sdk",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"license": "Apache-2.0",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/covalenthq/covalent-api-sdk-ts.git"
|
|
8
|
-
},
|
|
9
|
-
"author": {
|
|
10
|
-
"name": "covalenthq",
|
|
11
|
-
"url": "https://covalenthq.com"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/covalenthq/covalent-api-sdk-ts/issues"
|
|
15
|
-
},
|
|
16
|
-
"homepage": "https://github.com/covalenthq/covalent-api-sdk-ts#readme",
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"big.js": "^6.2.1"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"@rollup/plugin-
|
|
23
|
-
"@rollup/plugin-
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@types/
|
|
27
|
-
"@types/
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"
|
|
31
|
-
"eslint": "^
|
|
32
|
-
"
|
|
33
|
-
"eslint
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@covalenthq/client-sdk",
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/covalenthq/covalent-api-sdk-ts.git"
|
|
8
|
+
},
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "covalenthq",
|
|
11
|
+
"url": "https://covalenthq.com"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/covalenthq/covalent-api-sdk-ts/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/covalenthq/covalent-api-sdk-ts#readme",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"big.js": "^6.2.1",
|
|
19
|
+
"graphql-ws": "^6.0.5"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@rollup/plugin-commonjs": "^25.0.4",
|
|
23
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
24
|
+
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
25
|
+
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
26
|
+
"@types/big.js": "^6.2.2",
|
|
27
|
+
"@types/jest": "^29.5.5",
|
|
28
|
+
"@types/node": "^20",
|
|
29
|
+
"@types/ws": "^8.18.1",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
31
|
+
"@typescript-eslint/parser": "^7.7.1",
|
|
32
|
+
"dotenv": "^16.4.5",
|
|
33
|
+
"eslint": "^8",
|
|
34
|
+
"eslint-config-prettier": "^9.1.0",
|
|
35
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
36
|
+
"jest": "^29.6.1",
|
|
37
|
+
"p-limit": "^3.1.0",
|
|
38
|
+
"prettier": "^3.3.2",
|
|
39
|
+
"rimraf": "^6.0.1",
|
|
40
|
+
"rollup": "^3.29.1",
|
|
41
|
+
"rollup-plugin-typescript2": "^0.35.0",
|
|
42
|
+
"ts-jest": "^29.1.1",
|
|
43
|
+
"ts-node": "^10.9.2",
|
|
44
|
+
"typescript": "^5",
|
|
45
|
+
"ws": "^8.18.2"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"/dist"
|
|
52
|
+
],
|
|
53
|
+
"main": "dist/cjs/index.js",
|
|
54
|
+
"module": "dist/esm/index.js",
|
|
55
|
+
"exports": {
|
|
56
|
+
".": {
|
|
57
|
+
"import": "./dist/esm/index.js",
|
|
58
|
+
"require": "./dist/cjs/index.js",
|
|
59
|
+
"default": "./dist/esm/index.js"
|
|
60
|
+
},
|
|
61
|
+
"./cjs": "./cjs/index.js",
|
|
62
|
+
"./esm": "./esm/index.js",
|
|
63
|
+
"./types/cjs": "./types/cjs/index.d.ts",
|
|
64
|
+
"./types/esm": "./types/esm/index.d.ts",
|
|
65
|
+
"./package.json": "./package.json"
|
|
66
|
+
},
|
|
67
|
+
"types": "./dist/esm/index.d.ts",
|
|
68
|
+
"scripts": {
|
|
69
|
+
"test": "jest",
|
|
70
|
+
"build": "rollup -c rollup.config.js",
|
|
71
|
+
"clean": "rimraf dist",
|
|
72
|
+
"start": "rollup -c",
|
|
73
|
+
"lint": "eslint .",
|
|
74
|
+
"pretty": "prettier . --write"
|
|
75
|
+
}
|
|
76
|
+
}
|