@magmaprotocol/magma-clmm-sdk 0.5.74 → 0.5.76

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
@@ -2913,7 +2913,7 @@ declare class RewarderModule implements IModule {
2913
2913
  * @param tx
2914
2914
  * @returns
2915
2915
  */
2916
- batchCollectRewardePayload(params: CollectRewarderParams[], tx?: Transaction, inputCoinA?: TransactionObjectArgument, inputCoinB?: TransactionObjectArgument): Promise<Transaction>;
2916
+ batchCollectRewardePayload(params: CollectRewarderParams[], tx?: Transaction): Promise<Transaction>;
2917
2917
  createCollectRewarderPaylod(params: CollectRewarderParams, tx: Transaction, primaryCoinInputs: TransactionArgument[]): Transaction;
2918
2918
  createCollectRewarderNoSendPaylod(params: CollectRewarderParams, tx: Transaction, primaryCoinInputs: TransactionArgument[]): Transaction;
2919
2919
  }
package/dist/index.js CHANGED
@@ -6881,43 +6881,21 @@ var RewarderModule = class {
6881
6881
  * @param tx
6882
6882
  * @returns
6883
6883
  */
6884
- async batchCollectRewardePayload(params, tx, inputCoinA, inputCoinB) {
6884
+ async batchCollectRewardePayload(params, tx) {
6885
6885
  if (!checkInvalidSuiAddress(this._sdk.senderAddress)) {
6886
6886
  throw new ClmmpoolsError("this config sdk senderAddress is not set right", "InvalidSendAddress" /* InvalidSendAddress */);
6887
6887
  }
6888
6888
  const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress, null);
6889
6889
  tx = tx || new import_transactions6.Transaction();
6890
- const coinIdMaps = [];
6890
+ const coinIdList = [];
6891
6891
  params.forEach((item) => {
6892
6892
  const coinTypeA = normalizeCoinType(item.coinTypeA);
6893
6893
  const coinTypeB = normalizeCoinType(item.coinTypeB);
6894
6894
  if (item.collect_fee) {
6895
- let coinAInput = null;
6896
- if (inputCoinA == null) {
6897
- coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false, true);
6898
- } else {
6899
- coinAInput = {
6900
- targetCoin: inputCoinA,
6901
- remainCoins: [],
6902
- isMintZeroCoin: true,
6903
- tragetCoinAmount: "0"
6904
- };
6905
- coinIdMaps.push({ coin: coinAInput, coin_addr: coinTypeA });
6906
- }
6907
- let coinBInput = null;
6908
- if (coinBInput == null) {
6909
- if (inputCoinB == null) {
6910
- coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false, true);
6911
- } else {
6912
- coinBInput = {
6913
- targetCoin: inputCoinB,
6914
- remainCoins: [],
6915
- isMintZeroCoin: true,
6916
- tragetCoinAmount: "0"
6917
- };
6918
- }
6919
- coinIdMaps.push({ coin: coinBInput, coin_addr: coinTypeB });
6920
- }
6895
+ const coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false, true);
6896
+ const coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false, true);
6897
+ coinIdList.push({ coin: coinAInput, coin_addr: coinTypeA });
6898
+ coinIdList.push({ coin: coinBInput, coin_addr: coinTypeB });
6921
6899
  tx = this._sdk.Position.createCollectFeeNoSendPaylod(
6922
6900
  {
6923
6901
  pool_id: item.pool_id,
@@ -6933,16 +6911,13 @@ var RewarderModule = class {
6933
6911
  const primaryCoinInputs = [];
6934
6912
  item.rewarder_coin_types.forEach((type) => {
6935
6913
  const coinType = normalizeCoinType(type);
6936
- let coinInput;
6937
- if (coinInput === void 0) {
6938
- coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
6939
- coinIdMaps.push({ coin: coinInput, coin_addr: coinType });
6940
- }
6914
+ const coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
6941
6915
  primaryCoinInputs.push(coinInput.targetCoin);
6916
+ coinIdList.push({ coin: coinInput, coin_addr: coinType });
6942
6917
  });
6943
6918
  tx = this.createCollectRewarderNoSendPaylod(item, tx, primaryCoinInputs);
6944
6919
  });
6945
- coinIdMaps.forEach((item) => {
6920
+ coinIdList.forEach((item) => {
6946
6921
  TransactionUtil.buildTransferCoin(this._sdk, tx, item.coin.targetCoin, item.coin_addr, this._sdk.senderAddress);
6947
6922
  });
6948
6923
  return tx;