@magmaprotocol/magma-clmm-sdk 0.5.35 → 0.5.37

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.d.ts CHANGED
@@ -3491,11 +3491,21 @@ type EventPairLiquidity = {
3491
3491
  bin_x: number[] | string[];
3492
3492
  bin_y: number[] | string[];
3493
3493
  };
3494
+ type DlmmPoolInfo = {
3495
+ pool_id: string;
3496
+ bin_step: number;
3497
+ coin_a: string;
3498
+ coin_b: string;
3499
+ base_factor: number;
3500
+ base_fee: number;
3501
+ active_index: number;
3502
+ };
3494
3503
 
3495
3504
  declare class DlmmModule implements IModule {
3496
3505
  protected _sdk: MagmaClmmSDK;
3497
3506
  constructor(sdk: MagmaClmmSDK);
3498
3507
  get sdk(): MagmaClmmSDK;
3508
+ getPoolInfo(pools: string[]): Promise<DlmmPoolInfo[]>;
3499
3509
  fetchPairParams(params: FetchPairParams): Promise<EventPairParams>;
3500
3510
  price_to_storage_id(price: string, bin_step: number, tokenADecimal: number, tokenBDecimal: number): number;
3501
3511
  createPairPayload(params: CreatePairParams): Promise<Transaction>;
package/dist/index.js CHANGED
@@ -10063,6 +10063,26 @@ var DlmmModule = class {
10063
10063
  get sdk() {
10064
10064
  return this._sdk;
10065
10065
  }
10066
+ async getPoolInfo(pools) {
10067
+ const objects = await this._sdk.fullClient.batchGetObjects(pools, { showContent: true });
10068
+ const poolList = [];
10069
+ objects.forEach((obj) => {
10070
+ if (obj.error != null || obj.data?.content?.dataType !== "moveObject") {
10071
+ throw new ClmmpoolsError(`Invalid objects. error: ${obj.error}`, "InvalidType" /* InvalidType */);
10072
+ }
10073
+ const fields = getObjectFields(obj);
10074
+ poolList.push({
10075
+ pool_id: fields.id.id,
10076
+ bin_step: fields.bin_step,
10077
+ coin_a: fields.x.fields.name,
10078
+ coin_b: fields.y.fields.name,
10079
+ base_factor: fields.params.fields.base_factor,
10080
+ base_fee: fields.params.fields.base_factor / 1e4 * (fields.bin_step / 1e4),
10081
+ active_index: fields.params.fields.active_index
10082
+ });
10083
+ });
10084
+ return poolList;
10085
+ }
10066
10086
  // eg: fetch pool active_index
10067
10087
  async fetchPairParams(params) {
10068
10088
  const tx = new import_transactions12.Transaction();