@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 +23 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -25
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopClient.d.ts +1 -1
- package/package.json +1 -1
- package/src/builders/coreBuilder.ts +23 -26
- package/src/models/scallopClient.ts +14 -11
package/dist/index.mjs
CHANGED
|
@@ -5046,41 +5046,37 @@ var generateCoreQuickMethod = ({
|
|
|
5046
5046
|
const sCoinName = builder.utils.parseSCoinName(poolCoinName);
|
|
5047
5047
|
if (!sCoinName)
|
|
5048
5048
|
throw new Error(`No sCoin for ${poolCoinName}`);
|
|
5049
|
-
const {
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
);
|
|
5049
|
+
const {
|
|
5050
|
+
leftCoin,
|
|
5051
|
+
takeCoin: sCoins2,
|
|
5052
|
+
totalAmount
|
|
5053
|
+
} = await builder.selectSCoin(txBlock, sCoinName, amount, sender);
|
|
5055
5054
|
txBlock.transferObjects([leftCoin], sender);
|
|
5056
|
-
const
|
|
5057
|
-
const txResult = txBlock.withdraw(marketCoin, poolCoinName);
|
|
5055
|
+
const marketCoins2 = txBlock.burnSCoin(sCoinName, sCoins2);
|
|
5058
5056
|
amount -= totalAmount;
|
|
5059
5057
|
try {
|
|
5060
5058
|
if (amount > 0) {
|
|
5061
|
-
const { leftCoin: leftCoin2, takeCoin:
|
|
5059
|
+
const { leftCoin: leftCoin2, takeCoin: walletMarketCoins } = await builder.selectMarketCoin(
|
|
5062
5060
|
txBlock,
|
|
5063
5061
|
marketCoinName,
|
|
5064
5062
|
amount,
|
|
5065
5063
|
sender
|
|
5066
5064
|
);
|
|
5067
5065
|
txBlock.transferObjects([leftCoin2], sender);
|
|
5068
|
-
txBlock.mergeCoins(
|
|
5069
|
-
txBlock.withdraw(takeCoin2, poolCoinName)
|
|
5070
|
-
]);
|
|
5066
|
+
txBlock.mergeCoins(marketCoins2, [walletMarketCoins]);
|
|
5071
5067
|
}
|
|
5072
5068
|
} catch (e) {
|
|
5073
5069
|
}
|
|
5074
|
-
return
|
|
5070
|
+
return txBlock.withdraw(marketCoins2, poolCoinName);
|
|
5075
5071
|
} catch (e) {
|
|
5076
|
-
const { leftCoin, takeCoin } = await builder.selectMarketCoin(
|
|
5072
|
+
const { leftCoin, takeCoin: walletMarketCoins } = await builder.selectMarketCoin(
|
|
5077
5073
|
txBlock,
|
|
5078
5074
|
marketCoinName,
|
|
5079
5075
|
amount,
|
|
5080
5076
|
sender
|
|
5081
5077
|
);
|
|
5082
5078
|
txBlock.transferObjects([leftCoin], sender);
|
|
5083
|
-
return txBlock.withdraw(
|
|
5079
|
+
return txBlock.withdraw(walletMarketCoins, poolCoinName);
|
|
5084
5080
|
}
|
|
5085
5081
|
},
|
|
5086
5082
|
borrowQuick: async (amount, poolCoinName, obligationId, obligationKey) => {
|
|
@@ -7679,7 +7675,7 @@ var ScallopClient = class {
|
|
|
7679
7675
|
* Function to migrate all market coin in user wallet into sCoin
|
|
7680
7676
|
* @returns Transaction response
|
|
7681
7677
|
*/
|
|
7682
|
-
async migrateAllMarketCoin(sign = true) {
|
|
7678
|
+
async migrateAllMarketCoin(includeStakePool = true, sign = true) {
|
|
7683
7679
|
const txBlock = this.builder.createTxBlock();
|
|
7684
7680
|
txBlock.setSender(this.walletAddress);
|
|
7685
7681
|
const toTransfer = [];
|
|
@@ -7715,16 +7711,18 @@ var ScallopClient = class {
|
|
|
7715
7711
|
);
|
|
7716
7712
|
sCoins2.push(sCoin);
|
|
7717
7713
|
}
|
|
7718
|
-
if (
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7714
|
+
if (includeStakePool) {
|
|
7715
|
+
if (SUPPORT_SPOOLS.includes(sCoinName)) {
|
|
7716
|
+
try {
|
|
7717
|
+
const sCoin = await txBlock.unstakeQuick(
|
|
7718
|
+
Number.MAX_SAFE_INTEGER,
|
|
7719
|
+
sCoinName
|
|
7720
|
+
);
|
|
7721
|
+
if (sCoin) {
|
|
7722
|
+
sCoins2.push(sCoin);
|
|
7723
|
+
}
|
|
7724
|
+
} catch (e) {
|
|
7726
7725
|
}
|
|
7727
|
-
} catch (e) {
|
|
7728
7726
|
}
|
|
7729
7727
|
}
|
|
7730
7728
|
if (sCoins2.length > 0) {
|