@magmaprotocol/magma-clmm-sdk 0.5.71 → 0.5.72

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
@@ -6667,27 +6667,24 @@ var RewarderModule = class {
6667
6667
  }
6668
6668
  const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress, null);
6669
6669
  tx = tx || new Transaction6();
6670
- const coinIdMaps = {};
6671
- const coinIdMaps2 = {};
6670
+ const coinIdMaps = [];
6672
6671
  params.forEach((item) => {
6673
6672
  const coinTypeA = normalizeCoinType(item.coinTypeA);
6674
6673
  const coinTypeB = normalizeCoinType(item.coinTypeB);
6675
6674
  if (item.collect_fee) {
6676
- let coinAInput = coinIdMaps[coinTypeA];
6677
- if (coinAInput == null) {
6678
- if (inputCoinA == null) {
6679
- coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false, true);
6680
- } else {
6681
- coinAInput = {
6682
- targetCoin: inputCoinA,
6683
- remainCoins: [],
6684
- isMintZeroCoin: false,
6685
- tragetCoinAmount: "0"
6686
- };
6687
- }
6688
- coinIdMaps[coinTypeA] = coinAInput;
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: false,
6683
+ tragetCoinAmount: "0"
6684
+ };
6685
+ coinIdMaps.push({ coin: coinAInput, coin_addr: coinTypeA });
6689
6686
  }
6690
- let coinBInput = coinIdMaps[coinTypeB];
6687
+ let coinBInput = null;
6691
6688
  if (coinBInput == null) {
6692
6689
  if (inputCoinB == null) {
6693
6690
  coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false, true);
@@ -6699,7 +6696,7 @@ var RewarderModule = class {
6699
6696
  tragetCoinAmount: "0"
6700
6697
  };
6701
6698
  }
6702
- coinIdMaps[coinTypeB] = coinBInput;
6699
+ coinIdMaps.push({ coin: coinBInput, coin_addr: coinTypeB });
6703
6700
  }
6704
6701
  tx = this._sdk.Position.createCollectFeeNoSendPaylod(
6705
6702
  {
@@ -6716,25 +6713,18 @@ var RewarderModule = class {
6716
6713
  const primaryCoinInputs = [];
6717
6714
  item.rewarder_coin_types.forEach((type) => {
6718
6715
  const coinType = normalizeCoinType(type);
6719
- let coinInput = coinIdMaps2[type];
6716
+ let coinInput;
6720
6717
  if (coinInput === void 0) {
6721
6718
  coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
6722
- coinIdMaps2[coinType] = coinInput;
6719
+ coinIdMaps.push({ coin: coinInput, coin_addr: coinType });
6723
6720
  }
6724
6721
  primaryCoinInputs.push(coinInput.targetCoin);
6725
6722
  });
6726
6723
  tx = this.createCollectRewarderNoSendPaylod(item, tx, primaryCoinInputs);
6727
6724
  });
6728
- Object.keys(coinIdMaps).forEach((key) => {
6729
- const value = coinIdMaps[key];
6730
- if (value.isMintZeroCoin) {
6731
- TransactionUtil.buildTransferCoin(this._sdk, tx, value.targetCoin, key, this._sdk.senderAddress);
6732
- }
6733
- });
6734
- Object.keys(coinIdMaps2).forEach((key) => {
6735
- const value = coinIdMaps2[key];
6736
- if (value.isMintZeroCoin) {
6737
- TransactionUtil.buildTransferCoin(this._sdk, tx, value.targetCoin, key, this._sdk.senderAddress);
6725
+ coinIdMaps.forEach((item) => {
6726
+ if (item.coin.isMintZeroCoin) {
6727
+ TransactionUtil.buildTransferCoin(this._sdk, tx, item.coin.targetCoin, item.coin_addr, this._sdk.senderAddress);
6738
6728
  }
6739
6729
  });
6740
6730
  return tx;