@covalenthq/client-sdk 2.3.2 → 2.3.4
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/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = "2.3.
|
|
3
|
+
var version = "2.3.4";
|
|
4
4
|
|
|
5
5
|
const bigIntParser = (val) => {
|
|
6
6
|
if (val === null || val === undefined) {
|
|
@@ -3411,6 +3411,81 @@ class StreamingService {
|
|
|
3411
3411
|
complete: callbacks.complete || (() => { }),
|
|
3412
3412
|
});
|
|
3413
3413
|
}
|
|
3414
|
+
/**
|
|
3415
|
+
* Subscribe to real-time updates for specific trading pairs including price, volume, and liquidity data
|
|
3416
|
+
*
|
|
3417
|
+
* @param params - Parameters for the update pairs stream
|
|
3418
|
+
* @param callbacks - Subscription callbacks
|
|
3419
|
+
* @returns Unsubscribe function
|
|
3420
|
+
*
|
|
3421
|
+
* @example
|
|
3422
|
+
* ```typescript
|
|
3423
|
+
* const unsubscribe = streamingService.subscribeToUpdatePairs(
|
|
3424
|
+
* {
|
|
3425
|
+
* chain_name: StreamingChain.BASE_MAINNET,
|
|
3426
|
+
* pair_addresses: [
|
|
3427
|
+
* "0x3f0296BF652e19bca772EC3dF08b32732F93014A"
|
|
3428
|
+
* ]
|
|
3429
|
+
* },
|
|
3430
|
+
* {
|
|
3431
|
+
* next: (data) => console.log("Pair Updates:", data),
|
|
3432
|
+
* error: (err) => console.error("Error:", err),
|
|
3433
|
+
* complete: () => console.log("Stream completed")
|
|
3434
|
+
* }
|
|
3435
|
+
* );
|
|
3436
|
+
* ```
|
|
3437
|
+
*/
|
|
3438
|
+
subscribeToUpdatePairs(params, callbacks) {
|
|
3439
|
+
const pairAddressesString = params.pair_addresses
|
|
3440
|
+
.map((addr) => `"${addr}"`)
|
|
3441
|
+
.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
|
+
}
|
|
3469
|
+
`;
|
|
3470
|
+
const client = StreamingWebSocketClient.getClient();
|
|
3471
|
+
return client.subscribe({
|
|
3472
|
+
query,
|
|
3473
|
+
}, {
|
|
3474
|
+
next: (data) => {
|
|
3475
|
+
if (data.data) {
|
|
3476
|
+
const updatePairsData = data.data.updatePairs;
|
|
3477
|
+
if (updatePairsData) {
|
|
3478
|
+
callbacks.next(updatePairsData);
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
else if (data.errors) {
|
|
3482
|
+
callbacks.error?.(data.errors);
|
|
3483
|
+
}
|
|
3484
|
+
},
|
|
3485
|
+
error: callbacks.error || (() => { }),
|
|
3486
|
+
complete: callbacks.complete || (() => { }),
|
|
3487
|
+
});
|
|
3488
|
+
}
|
|
3414
3489
|
/**
|
|
3415
3490
|
* Subscribe to real-time token balance updates for a specific wallet address
|
|
3416
3491
|
*
|
|
@@ -4465,9 +4540,9 @@ class GoldRushClient {
|
|
|
4465
4540
|
}
|
|
4466
4541
|
|
|
4467
4542
|
/*
|
|
4468
|
-
* big.js v6.2.
|
|
4543
|
+
* big.js v6.2.2
|
|
4469
4544
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
4470
|
-
* Copyright (c)
|
|
4545
|
+
* Copyright (c) 2024 Michael Mclaughlin
|
|
4471
4546
|
* https://github.com/MikeMcl/big.js/LICENCE.md
|
|
4472
4547
|
*/
|
|
4473
4548
|
|
|
@@ -5269,7 +5344,7 @@ P.sqrt = function () {
|
|
|
5269
5344
|
}
|
|
5270
5345
|
|
|
5271
5346
|
// Estimate.
|
|
5272
|
-
s = Math.sqrt(x
|
|
5347
|
+
s = Math.sqrt(+stringify(x, true, true));
|
|
5273
5348
|
|
|
5274
5349
|
// Math.sqrt underflow/overflow?
|
|
5275
5350
|
// Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
|
|
@@ -5434,7 +5509,7 @@ P[Symbol.for('nodejs.util.inspect.custom')] = P.toJSON = P.toString = function (
|
|
|
5434
5509
|
* Return the value of this Big as a primitve number.
|
|
5435
5510
|
*/
|
|
5436
5511
|
P.toNumber = function () {
|
|
5437
|
-
var n =
|
|
5512
|
+
var n = +stringify(this, true, true);
|
|
5438
5513
|
if (this.constructor.strict === true && !this.eq(n.toString())) {
|
|
5439
5514
|
throw Error(NAME + 'Imprecise conversion');
|
|
5440
5515
|
}
|
|
@@ -5645,6 +5720,8 @@ const timestampParser = (timestamp, type) => {
|
|
|
5645
5720
|
exports.StreamingChain = void 0;
|
|
5646
5721
|
(function (StreamingChain) {
|
|
5647
5722
|
StreamingChain["BASE_MAINNET"] = "BASE_MAINNET";
|
|
5723
|
+
StreamingChain["SOLANA_MAINNET"] = "SOLANA_MAINNET";
|
|
5724
|
+
StreamingChain["SONIC_MAINNET"] = "SONIC_MAINNET";
|
|
5648
5725
|
StreamingChain["ETH_MAINNET"] = "ETH_MAINNET";
|
|
5649
5726
|
StreamingChain["BSC_MAINNET"] = "BSC_MAINNET";
|
|
5650
5727
|
})(exports.StreamingChain || (exports.StreamingChain = {}));
|
|
@@ -5676,6 +5753,22 @@ exports.StreamingProtocol = void 0;
|
|
|
5676
5753
|
(function (StreamingProtocol) {
|
|
5677
5754
|
StreamingProtocol["UNISWAP_V2"] = "UNISWAP_V2";
|
|
5678
5755
|
StreamingProtocol["UNISWAP_V3"] = "UNISWAP_V3";
|
|
5756
|
+
StreamingProtocol["UNISWAP_V4"] = "UNISWAP_V4";
|
|
5757
|
+
StreamingProtocol["VIRTUALS_V2"] = "VIRTUALS_V2";
|
|
5758
|
+
StreamingProtocol["CLANKER"] = "CLANKER";
|
|
5759
|
+
StreamingProtocol["RAYDIUM_AMM"] = "RAYDIUM_AMM";
|
|
5760
|
+
StreamingProtocol["RAYDIUM_CPMM"] = "RAYDIUM_CPMM";
|
|
5761
|
+
StreamingProtocol["PUMP_DOT_FUN"] = "PUMP_DOT_FUN";
|
|
5762
|
+
StreamingProtocol["PUMP_FUN_AMM"] = "PUMP_FUN_AMM";
|
|
5763
|
+
StreamingProtocol["MOONSHOT"] = "MOONSHOT";
|
|
5764
|
+
StreamingProtocol["RAYDIUM_LAUNCH_LAB"] = "RAYDIUM_LAUNCH_LAB";
|
|
5765
|
+
StreamingProtocol["METEORA_DAMM"] = "METEORA_DAMM";
|
|
5766
|
+
StreamingProtocol["METEORA_DLMM"] = "METEORA_DLMM";
|
|
5767
|
+
StreamingProtocol["METEORA_DBC"] = "METEORA_DBC";
|
|
5768
|
+
StreamingProtocol["PANCAKESWAP_V2"] = "PANCAKESWAP_V2";
|
|
5769
|
+
StreamingProtocol["PANCAKESWAP_V3"] = "PANCAKESWAP_V3";
|
|
5770
|
+
StreamingProtocol["SHADOW_V2"] = "SHADOW_V2";
|
|
5771
|
+
StreamingProtocol["SHADOW_V3"] = "SHADOW_V3";
|
|
5679
5772
|
})(exports.StreamingProtocol || (exports.StreamingProtocol = {}));
|
|
5680
5773
|
|
|
5681
5774
|
exports.GoldRushClient = GoldRushClient;
|