@magmaprotocol/magma-clmm-sdk 0.5.75 → 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.mjs CHANGED
@@ -6661,43 +6661,21 @@ var RewarderModule = class {
6661
6661
  * @param tx
6662
6662
  * @returns
6663
6663
  */
6664
- async batchCollectRewardePayload(params, tx, inputCoinA, inputCoinB) {
6664
+ async batchCollectRewardePayload(params, tx) {
6665
6665
  if (!checkInvalidSuiAddress(this._sdk.senderAddress)) {
6666
6666
  throw new ClmmpoolsError("this config sdk senderAddress is not set right", "InvalidSendAddress" /* InvalidSendAddress */);
6667
6667
  }
6668
6668
  const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress, null);
6669
6669
  tx = tx || new Transaction6();
6670
- const coinIdMaps = [];
6670
+ const coinIdList = [];
6671
6671
  params.forEach((item) => {
6672
6672
  const coinTypeA = normalizeCoinType(item.coinTypeA);
6673
6673
  const coinTypeB = normalizeCoinType(item.coinTypeB);
6674
6674
  if (item.collect_fee) {
6675
- let coinAInput = null;
6676
- if (inputCoinA == null) {
6677
- coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false, true);
6678
- } else {
6679
- coinAInput = {
6680
- targetCoin: inputCoinA,
6681
- remainCoins: [],
6682
- isMintZeroCoin: true,
6683
- tragetCoinAmount: "0"
6684
- };
6685
- coinIdMaps.push({ coin: coinAInput, coin_addr: coinTypeA });
6686
- }
6687
- let coinBInput = null;
6688
- if (coinBInput == null) {
6689
- if (inputCoinB == null) {
6690
- coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false, true);
6691
- } else {
6692
- coinBInput = {
6693
- targetCoin: inputCoinB,
6694
- remainCoins: [],
6695
- isMintZeroCoin: true,
6696
- tragetCoinAmount: "0"
6697
- };
6698
- }
6699
- coinIdMaps.push({ coin: coinBInput, coin_addr: coinTypeB });
6700
- }
6675
+ const coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false, true);
6676
+ const coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false, true);
6677
+ coinIdList.push({ coin: coinAInput, coin_addr: coinTypeA });
6678
+ coinIdList.push({ coin: coinBInput, coin_addr: coinTypeB });
6701
6679
  tx = this._sdk.Position.createCollectFeeNoSendPaylod(
6702
6680
  {
6703
6681
  pool_id: item.pool_id,
@@ -6713,15 +6691,15 @@ var RewarderModule = class {
6713
6691
  const primaryCoinInputs = [];
6714
6692
  item.rewarder_coin_types.forEach((type) => {
6715
6693
  const coinType = normalizeCoinType(type);
6716
- let coinInput;
6717
- if (coinInput === void 0) {
6718
- coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
6719
- coinIdMaps.push({ coin: coinInput, coin_addr: coinType });
6720
- }
6694
+ const coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
6721
6695
  primaryCoinInputs.push(coinInput.targetCoin);
6696
+ coinIdList.push({ coin: coinInput, coin_addr: coinType });
6722
6697
  });
6723
6698
  tx = this.createCollectRewarderNoSendPaylod(item, tx, primaryCoinInputs);
6724
6699
  });
6700
+ coinIdList.forEach((item) => {
6701
+ TransactionUtil.buildTransferCoin(this._sdk, tx, item.coin.targetCoin, item.coin_addr, this._sdk.senderAddress);
6702
+ });
6725
6703
  return tx;
6726
6704
  }
6727
6705
  createCollectRewarderPaylod(params, tx, primaryCoinInputs) {