@covalenthq/client-sdk 2.3.4 → 2.3.6
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 +596 -595
- package/dist/index.js +203 -201
- package/dist/index.js.map +1 -1
- package/dist/src/utils/types/StreamingService.types.d.ts +5 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = "2.3.
|
|
3
|
+
var version = "2.3.6";
|
|
4
4
|
|
|
5
5
|
const bigIntParser = (val) => {
|
|
6
6
|
if (val === null || val === undefined) {
|
|
@@ -3177,41 +3177,41 @@ class StreamingService {
|
|
|
3177
3177
|
const pairAddressesString = params.pair_addresses
|
|
3178
3178
|
.map((addr) => `"${addr}"`)
|
|
3179
3179
|
.join(", ");
|
|
3180
|
-
const query = `
|
|
3181
|
-
subscription {
|
|
3182
|
-
ohlcvCandlesForPair(
|
|
3183
|
-
chain_name: ${params.chain_name}
|
|
3184
|
-
pair_addresses: [${pairAddressesString}]
|
|
3185
|
-
interval: ${params.interval}
|
|
3186
|
-
timeframe: ${params.timeframe}
|
|
3187
|
-
${params.limit ? `limit: ${params.limit}` : ""}
|
|
3188
|
-
) {
|
|
3189
|
-
open
|
|
3190
|
-
high
|
|
3191
|
-
low
|
|
3192
|
-
close
|
|
3193
|
-
volume
|
|
3194
|
-
price_usd
|
|
3195
|
-
volume_usd
|
|
3196
|
-
chain_name
|
|
3197
|
-
pair_address
|
|
3198
|
-
interval
|
|
3199
|
-
timeframe
|
|
3200
|
-
timestamp
|
|
3201
|
-
base_token {
|
|
3202
|
-
contract_name
|
|
3203
|
-
contract_address
|
|
3204
|
-
contract_decimals
|
|
3205
|
-
contract_ticker_symbol
|
|
3206
|
-
}
|
|
3207
|
-
quote_token {
|
|
3208
|
-
contract_name
|
|
3209
|
-
contract_address
|
|
3210
|
-
contract_decimals
|
|
3211
|
-
contract_ticker_symbol
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
|
-
}
|
|
3180
|
+
const query = `
|
|
3181
|
+
subscription {
|
|
3182
|
+
ohlcvCandlesForPair(
|
|
3183
|
+
chain_name: ${params.chain_name}
|
|
3184
|
+
pair_addresses: [${pairAddressesString}]
|
|
3185
|
+
interval: ${params.interval}
|
|
3186
|
+
timeframe: ${params.timeframe}
|
|
3187
|
+
${params.limit ? `limit: ${params.limit}` : ""}
|
|
3188
|
+
) {
|
|
3189
|
+
open
|
|
3190
|
+
high
|
|
3191
|
+
low
|
|
3192
|
+
close
|
|
3193
|
+
volume
|
|
3194
|
+
price_usd
|
|
3195
|
+
volume_usd
|
|
3196
|
+
chain_name
|
|
3197
|
+
pair_address
|
|
3198
|
+
interval
|
|
3199
|
+
timeframe
|
|
3200
|
+
timestamp
|
|
3201
|
+
base_token {
|
|
3202
|
+
contract_name
|
|
3203
|
+
contract_address
|
|
3204
|
+
contract_decimals
|
|
3205
|
+
contract_ticker_symbol
|
|
3206
|
+
}
|
|
3207
|
+
quote_token {
|
|
3208
|
+
contract_name
|
|
3209
|
+
contract_address
|
|
3210
|
+
contract_decimals
|
|
3211
|
+
contract_ticker_symbol
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
3215
|
`;
|
|
3216
3216
|
const client = StreamingWebSocketClient.getClient();
|
|
3217
3217
|
return client.subscribe({
|
|
@@ -3261,42 +3261,42 @@ class StreamingService {
|
|
|
3261
3261
|
const tokenAddressesString = params.token_addresses
|
|
3262
3262
|
.map((addr) => `"${addr}"`)
|
|
3263
3263
|
.join(", ");
|
|
3264
|
-
const query = `
|
|
3265
|
-
subscription {
|
|
3266
|
-
ohlcvCandlesForToken(
|
|
3267
|
-
chain_name: ${params.chain_name}
|
|
3268
|
-
token_addresses: [${tokenAddressesString}]
|
|
3269
|
-
interval: ${params.interval}
|
|
3270
|
-
timeframe: ${params.timeframe}
|
|
3271
|
-
${params.limit ? `limit: ${params.limit}` : ""}
|
|
3272
|
-
) {
|
|
3273
|
-
chain_name
|
|
3274
|
-
pair_address
|
|
3275
|
-
interval
|
|
3276
|
-
timeframe
|
|
3277
|
-
timestamp
|
|
3278
|
-
open
|
|
3279
|
-
high
|
|
3280
|
-
low
|
|
3281
|
-
close
|
|
3282
|
-
volume
|
|
3283
|
-
volume_usd
|
|
3284
|
-
quote_rate
|
|
3285
|
-
quote_rate_usd
|
|
3286
|
-
base_token {
|
|
3287
|
-
contract_name
|
|
3288
|
-
contract_address
|
|
3289
|
-
contract_decimals
|
|
3290
|
-
contract_ticker_symbol
|
|
3291
|
-
}
|
|
3292
|
-
quote_token {
|
|
3293
|
-
contract_name
|
|
3294
|
-
contract_address
|
|
3295
|
-
contract_decimals
|
|
3296
|
-
contract_ticker_symbol
|
|
3297
|
-
}
|
|
3298
|
-
}
|
|
3299
|
-
}
|
|
3264
|
+
const query = `
|
|
3265
|
+
subscription {
|
|
3266
|
+
ohlcvCandlesForToken(
|
|
3267
|
+
chain_name: ${params.chain_name}
|
|
3268
|
+
token_addresses: [${tokenAddressesString}]
|
|
3269
|
+
interval: ${params.interval}
|
|
3270
|
+
timeframe: ${params.timeframe}
|
|
3271
|
+
${params.limit ? `limit: ${params.limit}` : ""}
|
|
3272
|
+
) {
|
|
3273
|
+
chain_name
|
|
3274
|
+
pair_address
|
|
3275
|
+
interval
|
|
3276
|
+
timeframe
|
|
3277
|
+
timestamp
|
|
3278
|
+
open
|
|
3279
|
+
high
|
|
3280
|
+
low
|
|
3281
|
+
close
|
|
3282
|
+
volume
|
|
3283
|
+
volume_usd
|
|
3284
|
+
quote_rate
|
|
3285
|
+
quote_rate_usd
|
|
3286
|
+
base_token {
|
|
3287
|
+
contract_name
|
|
3288
|
+
contract_address
|
|
3289
|
+
contract_decimals
|
|
3290
|
+
contract_ticker_symbol
|
|
3291
|
+
}
|
|
3292
|
+
quote_token {
|
|
3293
|
+
contract_name
|
|
3294
|
+
contract_address
|
|
3295
|
+
contract_decimals
|
|
3296
|
+
contract_ticker_symbol
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
3300
|
`;
|
|
3301
3301
|
const client = StreamingWebSocketClient.getClient();
|
|
3302
3302
|
return client.subscribe({
|
|
@@ -3340,57 +3340,45 @@ class StreamingService {
|
|
|
3340
3340
|
* ```
|
|
3341
3341
|
*/
|
|
3342
3342
|
subscribeToNewPairs(params, callbacks) {
|
|
3343
|
-
const query = `
|
|
3344
|
-
subscription {
|
|
3345
|
-
newPairs(
|
|
3346
|
-
chain_name: ${params.chain_name},
|
|
3347
|
-
protocols: [${params.protocols.join(", ")}]
|
|
3348
|
-
) {
|
|
3349
|
-
chain_name
|
|
3350
|
-
protocol
|
|
3351
|
-
protocol_version
|
|
3352
|
-
pair_address
|
|
3353
|
-
deployer_address
|
|
3354
|
-
tx_hash
|
|
3355
|
-
block_signed_at
|
|
3356
|
-
liquidity
|
|
3357
|
-
supply
|
|
3358
|
-
market_cap
|
|
3359
|
-
event_name
|
|
3360
|
-
quote_rate
|
|
3361
|
-
quote_rate_usd
|
|
3362
|
-
base_token_metadata {
|
|
3363
|
-
contract_address
|
|
3364
|
-
contract_decimals
|
|
3365
|
-
contract_name
|
|
3366
|
-
contract_ticker_symbol
|
|
3367
|
-
}
|
|
3368
|
-
pair_metadata {
|
|
3369
|
-
contract_address
|
|
3370
|
-
contract_decimals
|
|
3371
|
-
contract_name
|
|
3372
|
-
contract_ticker_symbol
|
|
3373
|
-
}
|
|
3374
|
-
quote_token_metadata {
|
|
3375
|
-
contract_address
|
|
3376
|
-
contract_decimals
|
|
3377
|
-
contract_name
|
|
3378
|
-
contract_ticker_symbol
|
|
3379
|
-
}
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
last_1hr
|
|
3383
|
-
last_6hr
|
|
3384
|
-
last_24hr
|
|
3385
|
-
}
|
|
3386
|
-
swaps {
|
|
3387
|
-
last_5m
|
|
3388
|
-
last_1hr
|
|
3389
|
-
last_6hr
|
|
3390
|
-
last_24hr
|
|
3391
|
-
}
|
|
3392
|
-
}
|
|
3393
|
-
}
|
|
3343
|
+
const query = `
|
|
3344
|
+
subscription {
|
|
3345
|
+
newPairs(
|
|
3346
|
+
chain_name: ${params.chain_name},
|
|
3347
|
+
protocols: [${params.protocols.join(", ")}]
|
|
3348
|
+
) {
|
|
3349
|
+
chain_name
|
|
3350
|
+
protocol
|
|
3351
|
+
protocol_version
|
|
3352
|
+
pair_address
|
|
3353
|
+
deployer_address
|
|
3354
|
+
tx_hash
|
|
3355
|
+
block_signed_at
|
|
3356
|
+
liquidity
|
|
3357
|
+
supply
|
|
3358
|
+
market_cap
|
|
3359
|
+
event_name
|
|
3360
|
+
quote_rate
|
|
3361
|
+
quote_rate_usd
|
|
3362
|
+
base_token_metadata {
|
|
3363
|
+
contract_address
|
|
3364
|
+
contract_decimals
|
|
3365
|
+
contract_name
|
|
3366
|
+
contract_ticker_symbol
|
|
3367
|
+
}
|
|
3368
|
+
pair_metadata {
|
|
3369
|
+
contract_address
|
|
3370
|
+
contract_decimals
|
|
3371
|
+
contract_name
|
|
3372
|
+
contract_ticker_symbol
|
|
3373
|
+
}
|
|
3374
|
+
quote_token_metadata {
|
|
3375
|
+
contract_address
|
|
3376
|
+
contract_decimals
|
|
3377
|
+
contract_name
|
|
3378
|
+
contract_ticker_symbol
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3394
3382
|
`;
|
|
3395
3383
|
const client = StreamingWebSocketClient.getClient();
|
|
3396
3384
|
return client.subscribe({
|
|
@@ -3439,33 +3427,45 @@ class StreamingService {
|
|
|
3439
3427
|
const pairAddressesString = params.pair_addresses
|
|
3440
3428
|
.map((addr) => `"${addr}"`)
|
|
3441
3429
|
.join(", ");
|
|
3442
|
-
const query = `
|
|
3443
|
-
subscription {
|
|
3444
|
-
updatePairs(
|
|
3445
|
-
chain_name: ${params.chain_name}
|
|
3446
|
-
pair_addresses: [${pairAddressesString}]
|
|
3447
|
-
) {
|
|
3448
|
-
chain_name
|
|
3449
|
-
pair_address
|
|
3450
|
-
timestamp
|
|
3451
|
-
price
|
|
3452
|
-
price_usd
|
|
3453
|
-
volume
|
|
3454
|
-
volume_usd
|
|
3455
|
-
base_token {
|
|
3456
|
-
contract_name
|
|
3457
|
-
contract_address
|
|
3458
|
-
contract_decimals
|
|
3459
|
-
contract_ticker_symbol
|
|
3460
|
-
}
|
|
3461
|
-
quote_token {
|
|
3462
|
-
contract_name
|
|
3463
|
-
contract_address
|
|
3464
|
-
contract_decimals
|
|
3465
|
-
contract_ticker_symbol
|
|
3466
|
-
}
|
|
3467
|
-
|
|
3468
|
-
|
|
3430
|
+
const query = `
|
|
3431
|
+
subscription {
|
|
3432
|
+
updatePairs(
|
|
3433
|
+
chain_name: ${params.chain_name}
|
|
3434
|
+
pair_addresses: [${pairAddressesString}]
|
|
3435
|
+
) {
|
|
3436
|
+
chain_name
|
|
3437
|
+
pair_address
|
|
3438
|
+
timestamp
|
|
3439
|
+
price
|
|
3440
|
+
price_usd
|
|
3441
|
+
volume
|
|
3442
|
+
volume_usd
|
|
3443
|
+
base_token {
|
|
3444
|
+
contract_name
|
|
3445
|
+
contract_address
|
|
3446
|
+
contract_decimals
|
|
3447
|
+
contract_ticker_symbol
|
|
3448
|
+
}
|
|
3449
|
+
quote_token {
|
|
3450
|
+
contract_name
|
|
3451
|
+
contract_address
|
|
3452
|
+
contract_decimals
|
|
3453
|
+
contract_ticker_symbol
|
|
3454
|
+
}
|
|
3455
|
+
price_deltas {
|
|
3456
|
+
last_5m
|
|
3457
|
+
last_1hr
|
|
3458
|
+
last_6hr
|
|
3459
|
+
last_24hr
|
|
3460
|
+
}
|
|
3461
|
+
swap_counts {
|
|
3462
|
+
last_5m
|
|
3463
|
+
last_1hr
|
|
3464
|
+
last_6hr
|
|
3465
|
+
last_24hr
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
3469
|
`;
|
|
3470
3470
|
const client = StreamingWebSocketClient.getClient();
|
|
3471
3471
|
return client.subscribe({
|
|
@@ -3509,30 +3509,30 @@ class StreamingService {
|
|
|
3509
3509
|
* ```
|
|
3510
3510
|
*/
|
|
3511
3511
|
subscribeToTokenBalances(params, callbacks) {
|
|
3512
|
-
const query = `
|
|
3513
|
-
subscription {
|
|
3514
|
-
tokenBalancesForWalletAddress(
|
|
3515
|
-
chain_name: ${params.chain_name},
|
|
3516
|
-
wallet_address: "${params.wallet_address}"
|
|
3517
|
-
) {
|
|
3518
|
-
wallet_address
|
|
3519
|
-
chain_name
|
|
3520
|
-
last_block
|
|
3521
|
-
items {
|
|
3522
|
-
balance
|
|
3523
|
-
balance_pretty
|
|
3524
|
-
quote_rate_usd
|
|
3525
|
-
quote_usd
|
|
3526
|
-
metadata {
|
|
3527
|
-
contract_name
|
|
3528
|
-
contract_address
|
|
3529
|
-
contract_decimals
|
|
3530
|
-
contract_ticker_symbol
|
|
3531
|
-
}
|
|
3532
|
-
is_native
|
|
3533
|
-
}
|
|
3534
|
-
}
|
|
3535
|
-
}
|
|
3512
|
+
const query = `
|
|
3513
|
+
subscription {
|
|
3514
|
+
tokenBalancesForWalletAddress(
|
|
3515
|
+
chain_name: ${params.chain_name},
|
|
3516
|
+
wallet_address: "${params.wallet_address}"
|
|
3517
|
+
) {
|
|
3518
|
+
wallet_address
|
|
3519
|
+
chain_name
|
|
3520
|
+
last_block
|
|
3521
|
+
items {
|
|
3522
|
+
balance
|
|
3523
|
+
balance_pretty
|
|
3524
|
+
quote_rate_usd
|
|
3525
|
+
quote_usd
|
|
3526
|
+
metadata {
|
|
3527
|
+
contract_name
|
|
3528
|
+
contract_address
|
|
3529
|
+
contract_decimals
|
|
3530
|
+
contract_ticker_symbol
|
|
3531
|
+
}
|
|
3532
|
+
is_native
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
3536
|
`;
|
|
3537
3537
|
const client = StreamingWebSocketClient.getClient();
|
|
3538
3538
|
return client.subscribe({
|
|
@@ -3580,33 +3580,33 @@ class StreamingService {
|
|
|
3580
3580
|
const walletAddressesString = params.wallet_addresses
|
|
3581
3581
|
.map((addr) => `"${addr}"`)
|
|
3582
3582
|
.join(", ");
|
|
3583
|
-
const query = `
|
|
3584
|
-
subscription {
|
|
3585
|
-
walletTxs(
|
|
3586
|
-
chain_name: ${params.chain_name},
|
|
3587
|
-
wallet_addresses: [${walletAddressesString}]
|
|
3588
|
-
) {
|
|
3589
|
-
tx_hash
|
|
3590
|
-
from_address
|
|
3591
|
-
to_address
|
|
3592
|
-
value
|
|
3593
|
-
chain_name
|
|
3594
|
-
block_signed_at
|
|
3595
|
-
block_height
|
|
3596
|
-
block_hash
|
|
3597
|
-
miner_address
|
|
3598
|
-
gas_used
|
|
3599
|
-
tx_offset
|
|
3600
|
-
successful
|
|
3601
|
-
decoded_type
|
|
3602
|
-
logs {
|
|
3603
|
-
emitter_address
|
|
3604
|
-
log_offset
|
|
3605
|
-
data
|
|
3606
|
-
topics
|
|
3607
|
-
}
|
|
3608
|
-
}
|
|
3609
|
-
}
|
|
3583
|
+
const query = `
|
|
3584
|
+
subscription {
|
|
3585
|
+
walletTxs(
|
|
3586
|
+
chain_name: ${params.chain_name},
|
|
3587
|
+
wallet_addresses: [${walletAddressesString}]
|
|
3588
|
+
) {
|
|
3589
|
+
tx_hash
|
|
3590
|
+
from_address
|
|
3591
|
+
to_address
|
|
3592
|
+
value
|
|
3593
|
+
chain_name
|
|
3594
|
+
block_signed_at
|
|
3595
|
+
block_height
|
|
3596
|
+
block_hash
|
|
3597
|
+
miner_address
|
|
3598
|
+
gas_used
|
|
3599
|
+
tx_offset
|
|
3600
|
+
successful
|
|
3601
|
+
decoded_type
|
|
3602
|
+
logs {
|
|
3603
|
+
emitter_address
|
|
3604
|
+
log_offset
|
|
3605
|
+
data
|
|
3606
|
+
topics
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
3610
|
`;
|
|
3611
3611
|
const client = StreamingWebSocketClient.getClient();
|
|
3612
3612
|
return client.subscribe({
|
|
@@ -5724,9 +5724,11 @@ exports.StreamingChain = void 0;
|
|
|
5724
5724
|
StreamingChain["SONIC_MAINNET"] = "SONIC_MAINNET";
|
|
5725
5725
|
StreamingChain["ETH_MAINNET"] = "ETH_MAINNET";
|
|
5726
5726
|
StreamingChain["BSC_MAINNET"] = "BSC_MAINNET";
|
|
5727
|
+
StreamingChain["HYPERCORE_MAINNET"] = "HYPERCORE_MAINNET";
|
|
5727
5728
|
})(exports.StreamingChain || (exports.StreamingChain = {}));
|
|
5728
5729
|
exports.StreamingInterval = void 0;
|
|
5729
5730
|
(function (StreamingInterval) {
|
|
5731
|
+
StreamingInterval["ONE_SECOND"] = "ONE_SECOND";
|
|
5730
5732
|
StreamingInterval["FIFTEEN_SECONDS"] = "FIFTEEN_SECONDS";
|
|
5731
5733
|
StreamingInterval["THIRTY_SECONDS"] = "THIRTY_SECONDS";
|
|
5732
5734
|
StreamingInterval["ONE_MINUTE"] = "ONE_MINUTE";
|