@magmaprotocol/magma-clmm-sdk 0.5.70 → 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.js +19 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
6671
|
-
const coinIdMaps = {};
|
|
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 =
|
|
6677
|
-
if (
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
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 =
|
|
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
|
|
6699
|
+
coinIdMaps.push({ coin: coinBInput, coin_addr: coinTypeB });
|
|
6703
6700
|
}
|
|
6704
6701
|
tx = this._sdk.Position.createCollectFeeNoSendPaylod(
|
|
6705
6702
|
{
|
|
@@ -6716,19 +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
|
|
6716
|
+
let coinInput;
|
|
6720
6717
|
if (coinInput === void 0) {
|
|
6721
6718
|
coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
|
|
6722
|
-
coinIdMaps
|
|
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
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
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);
|
|
6732
6728
|
}
|
|
6733
6729
|
});
|
|
6734
6730
|
return tx;
|