@magmaprotocol/magma-clmm-sdk 0.5.104 → 0.5.106
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 +3 -1
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1758,6 +1758,7 @@ type AlmmPoolInfo = {
|
|
|
1758
1758
|
coinAmountB: string;
|
|
1759
1759
|
index?: number;
|
|
1760
1760
|
liquidity: string;
|
|
1761
|
+
rewarder_infos: Rewarder[];
|
|
1761
1762
|
};
|
|
1762
1763
|
type AlmmAddLiquidityParams = {
|
|
1763
1764
|
pool_id: string;
|
|
@@ -3780,7 +3781,8 @@ declare class AlmmModule implements IModule {
|
|
|
3780
3781
|
private _raisePositionByAmountsReward;
|
|
3781
3782
|
burnPosition(params: AlmmBurnPositionParams): Promise<Transaction>;
|
|
3782
3783
|
shrinkPosition(params: AlmmShrinkPosition): Promise<Transaction>;
|
|
3783
|
-
|
|
3784
|
+
collectFeeAndRewardList(paramsList: AlmmCollectRewardParams[]): Promise<Transaction>;
|
|
3785
|
+
collectFeeAndReward(params: AlmmCollectRewardParams & AlmmCollectFeeParams, tx?: Transaction): Promise<Transaction>;
|
|
3784
3786
|
collectReward(params: AlmmCollectRewardParams, transaction?: Transaction): Promise<Transaction>;
|
|
3785
3787
|
collectFees(params: AlmmCollectFeeParams, transaction?: Transaction): Promise<Transaction>;
|
|
3786
3788
|
createPairAddLiquidity(params: AlmmCreatePairAddLiquidityParams): Promise<Transaction>;
|
package/dist/index.js
CHANGED
|
@@ -10636,6 +10636,7 @@ var GaugeModule = class {
|
|
|
10636
10636
|
var import_transactions12 = require("@mysten/sui/transactions");
|
|
10637
10637
|
var import_calc_dlmm3 = require("@magmaprotocol/calc_dlmm");
|
|
10638
10638
|
var import_decimal13 = __toESM(require("decimal.js"));
|
|
10639
|
+
var import_bn22 = __toESM(require("bn.js"));
|
|
10639
10640
|
var AlmmModule = class {
|
|
10640
10641
|
_sdk;
|
|
10641
10642
|
_cache = {};
|
|
@@ -10662,6 +10663,18 @@ var AlmmModule = class {
|
|
|
10662
10663
|
throw new ClmmpoolsError(`Invalid objects. error: ${obj.error}`, "InvalidType" /* InvalidType */);
|
|
10663
10664
|
}
|
|
10664
10665
|
const fields = getObjectFields(obj);
|
|
10666
|
+
const rewarders = [];
|
|
10667
|
+
fields.rewarder_manager.fields.rewarders.forEach((item) => {
|
|
10668
|
+
const { emissions_per_second } = item.fields;
|
|
10669
|
+
const emissionSeconds = MathUtil.fromX64(new import_bn22.default(emissions_per_second));
|
|
10670
|
+
const emissionsEveryDay = Math.floor(emissionSeconds.toNumber() * 60 * 60 * 24);
|
|
10671
|
+
rewarders.push({
|
|
10672
|
+
emissions_per_second,
|
|
10673
|
+
coinAddress: extractStructTagFromType(item.fields.reward_coin.fields.name).source_address,
|
|
10674
|
+
growth_global: item.fields.growth_global,
|
|
10675
|
+
emissionsEveryDay
|
|
10676
|
+
});
|
|
10677
|
+
});
|
|
10665
10678
|
const poolInfo = {
|
|
10666
10679
|
pool_id: fields.id.id,
|
|
10667
10680
|
bin_step: fields.bin_step,
|
|
@@ -10673,7 +10686,8 @@ var AlmmModule = class {
|
|
|
10673
10686
|
real_bin_id: (0, import_calc_dlmm3.get_real_id)(fields.params.fields.active_index),
|
|
10674
10687
|
coinAmountA: fields.reserve_x,
|
|
10675
10688
|
coinAmountB: fields.reserve_y,
|
|
10676
|
-
liquidity: fields.liquidity
|
|
10689
|
+
liquidity: fields.liquidity,
|
|
10690
|
+
rewarder_infos: rewarders
|
|
10677
10691
|
};
|
|
10678
10692
|
poolList.push(poolInfo);
|
|
10679
10693
|
this.updateCache(`${fields.id.id}_getPoolObject`, poolInfo, cacheTime24h);
|
|
@@ -11056,8 +11070,18 @@ var AlmmModule = class {
|
|
|
11056
11070
|
});
|
|
11057
11071
|
return tx;
|
|
11058
11072
|
}
|
|
11059
|
-
async
|
|
11073
|
+
async collectFeeAndRewardList(paramsList) {
|
|
11060
11074
|
let tx = new import_transactions12.Transaction();
|
|
11075
|
+
for (let index = 0; index < paramsList.length; index++) {
|
|
11076
|
+
const params = paramsList[index];
|
|
11077
|
+
tx = await this.collectFeeAndReward(params);
|
|
11078
|
+
}
|
|
11079
|
+
return tx;
|
|
11080
|
+
}
|
|
11081
|
+
async collectFeeAndReward(params, tx) {
|
|
11082
|
+
if (!tx) {
|
|
11083
|
+
tx = new import_transactions12.Transaction();
|
|
11084
|
+
}
|
|
11061
11085
|
tx = await this.collectFees(params);
|
|
11062
11086
|
if (params.rewards_token.length > 0) {
|
|
11063
11087
|
tx = await this.collectReward(params, tx);
|