@scallop-io/sui-scallop-sdk 0.46.58-alpha.1 → 0.46.60

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 CHANGED
@@ -5117,41 +5117,37 @@ var generateCoreQuickMethod = ({
5117
5117
  const sCoinName = builder.utils.parseSCoinName(poolCoinName);
5118
5118
  if (!sCoinName)
5119
5119
  throw new Error(`No sCoin for ${poolCoinName}`);
5120
- const { leftCoin, takeCoin, totalAmount } = await builder.selectSCoin(
5121
- txBlock,
5122
- sCoinName,
5123
- amount,
5124
- sender
5125
- );
5120
+ const {
5121
+ leftCoin,
5122
+ takeCoin: sCoins2,
5123
+ totalAmount
5124
+ } = await builder.selectSCoin(txBlock, sCoinName, amount, sender);
5126
5125
  txBlock.transferObjects([leftCoin], sender);
5127
- const marketCoin = txBlock.burnSCoin(sCoinName, takeCoin);
5128
- const txResult = txBlock.withdraw(marketCoin, poolCoinName);
5126
+ const marketCoins2 = txBlock.burnSCoin(sCoinName, sCoins2);
5129
5127
  amount -= totalAmount;
5130
5128
  try {
5131
5129
  if (amount > 0) {
5132
- const { leftCoin: leftCoin2, takeCoin: takeCoin2 } = await builder.selectMarketCoin(
5130
+ const { leftCoin: leftCoin2, takeCoin: walletMarketCoins } = await builder.selectMarketCoin(
5133
5131
  txBlock,
5134
5132
  marketCoinName,
5135
5133
  amount,
5136
5134
  sender
5137
5135
  );
5138
5136
  txBlock.transferObjects([leftCoin2], sender);
5139
- txBlock.mergeCoins(txResult, [
5140
- txBlock.withdraw(takeCoin2, poolCoinName)
5141
- ]);
5137
+ txBlock.mergeCoins(marketCoins2, [walletMarketCoins]);
5142
5138
  }
5143
5139
  } catch (e) {
5144
5140
  }
5145
- return txResult;
5141
+ return txBlock.withdraw(marketCoins2, poolCoinName);
5146
5142
  } catch (e) {
5147
- const { leftCoin, takeCoin } = await builder.selectMarketCoin(
5143
+ const { leftCoin, takeCoin: walletMarketCoins } = await builder.selectMarketCoin(
5148
5144
  txBlock,
5149
5145
  marketCoinName,
5150
5146
  amount,
5151
5147
  sender
5152
5148
  );
5153
5149
  txBlock.transferObjects([leftCoin], sender);
5154
- return txBlock.withdraw(takeCoin, poolCoinName);
5150
+ return txBlock.withdraw(walletMarketCoins, poolCoinName);
5155
5151
  }
5156
5152
  },
5157
5153
  borrowQuick: async (amount, poolCoinName, obligationId, obligationKey) => {
@@ -7739,7 +7735,7 @@ var ScallopClient = class {
7739
7735
  * Function to migrate all market coin in user wallet into sCoin
7740
7736
  * @returns Transaction response
7741
7737
  */
7742
- async migrateAllMarketCoin(sign = true) {
7738
+ async migrateAllMarketCoin(includeStakePool = true, sign = true) {
7743
7739
  const txBlock = this.builder.createTxBlock();
7744
7740
  txBlock.setSender(this.walletAddress);
7745
7741
  const toTransfer = [];
@@ -7775,16 +7771,18 @@ var ScallopClient = class {
7775
7771
  );
7776
7772
  sCoins2.push(sCoin);
7777
7773
  }
7778
- if (SUPPORT_SPOOLS.includes(sCoinName)) {
7779
- try {
7780
- const sCoin = await txBlock.unstakeQuick(
7781
- Number.MAX_SAFE_INTEGER,
7782
- sCoinName
7783
- );
7784
- if (sCoin) {
7785
- sCoins2.push(sCoin);
7774
+ if (includeStakePool) {
7775
+ if (SUPPORT_SPOOLS.includes(sCoinName)) {
7776
+ try {
7777
+ const sCoin = await txBlock.unstakeQuick(
7778
+ Number.MAX_SAFE_INTEGER,
7779
+ sCoinName
7780
+ );
7781
+ if (sCoin) {
7782
+ sCoins2.push(sCoin);
7783
+ }
7784
+ } catch (e) {
7786
7785
  }
7787
- } catch (e) {
7788
7786
  }
7789
7787
  }
7790
7788
  if (sCoins2.length > 0) {