@kamino-finance/kliquidity-sdk 7.0.1 → 7.0.3

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.
@@ -22,11 +22,15 @@ export interface MeteoraPool {
22
22
 
23
23
  export class MeteoraService {
24
24
  private readonly _connection: Connection;
25
- private readonly _globalConfig: PublicKey;
25
+ private readonly _meteoraProgramId: PublicKey;
26
26
 
27
- constructor(connection: Connection, globalConfig: PublicKey) {
27
+ constructor(connection: Connection, meteoraProgramId: PublicKey = METEORA_PROGRAM_ID) {
28
28
  this._connection = connection;
29
- this._globalConfig = globalConfig;
29
+ this._meteoraProgramId = meteoraProgramId;
30
+ }
31
+
32
+ getMeteoraProgramId(): PublicKey {
33
+ return this._meteoraProgramId;
30
34
  }
31
35
 
32
36
  async getPool(poolAddress: PublicKey): Promise<LbPair | null> {
@@ -25,28 +25,22 @@ import {
25
25
  import { WHIRLPOOL_PROGRAM_ID } from '../whirlpools-client/programId';
26
26
  import { CollateralInfo } from '../kamino-client/types';
27
27
  import { KaminoPrices } from '../models';
28
- import { PROGRAM_ID } from '../kamino-client/programId';
29
28
 
30
29
  export class OrcaService {
31
30
  private readonly _connection: Connection;
32
- private readonly _cluster: SolanaCluster;
31
+ private readonly _whirilpoolProgramId: PublicKey;
33
32
  private readonly _orcaNetwork: OrcaNetwork;
34
33
  private readonly _orcaApiUrl: string;
35
- private readonly _globalConfig: PublicKey;
36
- private readonly _kaminoProgramId: PublicKey;
37
-
38
- constructor(
39
- connection: Connection,
40
- cluster: SolanaCluster,
41
- globalConfig: PublicKey,
42
- kaminoProgramId: PublicKey = PROGRAM_ID
43
- ) {
34
+
35
+ constructor(connection: Connection, cluster: SolanaCluster, whirlpoolProgramId: PublicKey = WHIRLPOOL_PROGRAM_ID) {
44
36
  this._connection = connection;
45
- this._cluster = cluster;
46
- this._globalConfig = globalConfig;
37
+ this._whirilpoolProgramId = whirlpoolProgramId;
47
38
  this._orcaNetwork = cluster === 'mainnet-beta' ? OrcaNetwork.MAINNET : OrcaNetwork.DEVNET;
48
39
  this._orcaApiUrl = `https://api.${cluster === 'mainnet-beta' ? 'mainnet' : 'devnet'}.orca.so`;
49
- this._kaminoProgramId = kaminoProgramId;
40
+ }
41
+
42
+ getWhirlpoolProgramId(): PublicKey {
43
+ return this._whirilpoolProgramId;
50
44
  }
51
45
 
52
46
  async getOrcaWhirlpools() {
@@ -1,5 +1,4 @@
1
1
  import { Connection, PublicKey } from '@solana/web3.js';
2
- import { SolanaCluster } from '@hubbleprotocol/hubble-config';
3
2
  import {
4
3
  LiquidityDistribution as RaydiumLiquidityDistribuion,
5
4
  Pool,
@@ -25,11 +24,15 @@ import { priceToTickIndexWithRounding } from '../utils/raydium';
25
24
 
26
25
  export class RaydiumService {
27
26
  private readonly _connection: Connection;
28
- private readonly _cluster: SolanaCluster;
27
+ private readonly _raydiumProgramId: PublicKey;
29
28
 
30
- constructor(connection: Connection, cluster: SolanaCluster) {
29
+ constructor(connection: Connection, raydiumProgramId: PublicKey = RAYDIUM_PROGRAM_ID) {
30
+ this._raydiumProgramId = raydiumProgramId;
31
31
  this._connection = connection;
32
- this._cluster = cluster;
32
+ }
33
+
34
+ getRaydiumProgramId(): PublicKey {
35
+ return this._raydiumProgramId;
33
36
  }
34
37
 
35
38
  async getRaydiumWhirlpools(): Promise<RaydiumPoolsResponse> {
@@ -307,7 +310,7 @@ export class RaydiumService {
307
310
  }
308
311
 
309
312
  async getPositionsCountByPool(pool: PublicKey): Promise<number> {
310
- const positions = await this._connection.getProgramAccounts(RAYDIUM_PROGRAM_ID, {
313
+ const positions = await this._connection.getProgramAccounts(this._raydiumProgramId, {
311
314
  commitment: 'confirmed',
312
315
  filters: [
313
316
  { dataSize: PositionInfoLayout.span },