@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.js +19 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6887,27 +6887,24 @@ var RewarderModule = class {
|
|
|
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 =
|
|
6891
|
-
const coinIdMaps2 = {};
|
|
6890
|
+
const coinIdMaps = [];
|
|
6892
6891
|
params.forEach((item) => {
|
|
6893
6892
|
const coinTypeA = normalizeCoinType(item.coinTypeA);
|
|
6894
6893
|
const coinTypeB = normalizeCoinType(item.coinTypeB);
|
|
6895
6894
|
if (item.collect_fee) {
|
|
6896
|
-
let coinAInput =
|
|
6897
|
-
if (
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
}
|
|
6908
|
-
coinIdMaps[coinTypeA] = coinAInput;
|
|
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: false,
|
|
6903
|
+
tragetCoinAmount: "0"
|
|
6904
|
+
};
|
|
6905
|
+
coinIdMaps.push({ coin: coinAInput, coin_addr: coinTypeA });
|
|
6909
6906
|
}
|
|
6910
|
-
let coinBInput =
|
|
6907
|
+
let coinBInput = null;
|
|
6911
6908
|
if (coinBInput == null) {
|
|
6912
6909
|
if (inputCoinB == null) {
|
|
6913
6910
|
coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false, true);
|
|
@@ -6919,7 +6916,7 @@ var RewarderModule = class {
|
|
|
6919
6916
|
tragetCoinAmount: "0"
|
|
6920
6917
|
};
|
|
6921
6918
|
}
|
|
6922
|
-
coinIdMaps
|
|
6919
|
+
coinIdMaps.push({ coin: coinBInput, coin_addr: coinTypeB });
|
|
6923
6920
|
}
|
|
6924
6921
|
tx = this._sdk.Position.createCollectFeeNoSendPaylod(
|
|
6925
6922
|
{
|
|
@@ -6936,25 +6933,18 @@ var RewarderModule = class {
|
|
|
6936
6933
|
const primaryCoinInputs = [];
|
|
6937
6934
|
item.rewarder_coin_types.forEach((type) => {
|
|
6938
6935
|
const coinType = normalizeCoinType(type);
|
|
6939
|
-
let coinInput
|
|
6936
|
+
let coinInput;
|
|
6940
6937
|
if (coinInput === void 0) {
|
|
6941
6938
|
coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false, true);
|
|
6942
|
-
|
|
6939
|
+
coinIdMaps.push({ coin: coinInput, coin_addr: coinType });
|
|
6943
6940
|
}
|
|
6944
6941
|
primaryCoinInputs.push(coinInput.targetCoin);
|
|
6945
6942
|
});
|
|
6946
6943
|
tx = this.createCollectRewarderNoSendPaylod(item, tx, primaryCoinInputs);
|
|
6947
6944
|
});
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
TransactionUtil.buildTransferCoin(this._sdk, tx, value.targetCoin, key, this._sdk.senderAddress);
|
|
6952
|
-
}
|
|
6953
|
-
});
|
|
6954
|
-
Object.keys(coinIdMaps2).forEach((key) => {
|
|
6955
|
-
const value = coinIdMaps2[key];
|
|
6956
|
-
if (value.isMintZeroCoin) {
|
|
6957
|
-
TransactionUtil.buildTransferCoin(this._sdk, tx, value.targetCoin, key, this._sdk.senderAddress);
|
|
6945
|
+
coinIdMaps.forEach((item) => {
|
|
6946
|
+
if (item.coin.isMintZeroCoin) {
|
|
6947
|
+
TransactionUtil.buildTransferCoin(this._sdk, tx, item.coin.targetCoin, item.coin_addr, this._sdk.senderAddress);
|
|
6958
6948
|
}
|
|
6959
6949
|
});
|
|
6960
6950
|
return tx;
|