@scallop-io/sui-scallop-sdk 0.46.44 → 0.46.46
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 +11 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/scallopClient.ts +13 -28
package/package.json
CHANGED
|
@@ -742,12 +742,12 @@ export class ScallopClient {
|
|
|
742
742
|
const sender = walletAddress || this.walletAddress;
|
|
743
743
|
txBlock.setSender(sender);
|
|
744
744
|
|
|
745
|
-
const
|
|
745
|
+
const marketCoin = await txBlock.unstakeQuick(
|
|
746
746
|
amount,
|
|
747
747
|
stakeMarketCoinName,
|
|
748
748
|
stakeAccountId
|
|
749
749
|
);
|
|
750
|
-
txBlock.transferObjects(
|
|
750
|
+
txBlock.transferObjects([marketCoin], sender);
|
|
751
751
|
|
|
752
752
|
if (sign) {
|
|
753
753
|
return (await this.suiKit.signAndSendTxn(
|
|
@@ -790,20 +790,16 @@ export class ScallopClient {
|
|
|
790
790
|
const sender = walletAddress || this.walletAddress;
|
|
791
791
|
txBlock.setSender(sender);
|
|
792
792
|
|
|
793
|
-
const
|
|
793
|
+
const stakeMarketCoin = await txBlock.unstakeQuick(
|
|
794
794
|
amount,
|
|
795
795
|
stakeMarketCoinName,
|
|
796
796
|
stakeAccountId
|
|
797
797
|
);
|
|
798
|
+
const stakeCoinName =
|
|
799
|
+
this.utils.parseCoinName<SupportStakeCoins>(stakeMarketCoinName);
|
|
800
|
+
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
798
801
|
|
|
799
|
-
|
|
800
|
-
for (const stakeMarketCoin of stakeMarketCoins) {
|
|
801
|
-
const stakeCoinName =
|
|
802
|
-
this.utils.parseCoinName<SupportStakeCoins>(stakeMarketCoinName);
|
|
803
|
-
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
804
|
-
coins.push(coin);
|
|
805
|
-
}
|
|
806
|
-
txBlock.transferObjects(coins, sender);
|
|
802
|
+
txBlock.transferObjects([coin], sender);
|
|
807
803
|
|
|
808
804
|
if (sign) {
|
|
809
805
|
return (await this.suiKit.signAndSendTxn(
|
|
@@ -1006,26 +1002,15 @@ export class ScallopClient {
|
|
|
1006
1002
|
// check for staked market coin in spool
|
|
1007
1003
|
if (SUPPORT_SPOOLS.includes(sCoinName as SupportStakeMarketCoins)) {
|
|
1008
1004
|
try {
|
|
1009
|
-
const
|
|
1005
|
+
const stakedMarketCoin = await txBlock.unstakeQuick(
|
|
1010
1006
|
Number.MAX_SAFE_INTEGER,
|
|
1011
1007
|
sCoinName as SupportStakeMarketCoins
|
|
1012
1008
|
);
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
stakedMarketCoins.slice(1)
|
|
1019
|
-
);
|
|
1020
|
-
}
|
|
1021
|
-
// merge with takeMarketCoin
|
|
1022
|
-
if (toDestroyMarketCoin) {
|
|
1023
|
-
txBlock.mergeCoins(toDestroyMarketCoin, [
|
|
1024
|
-
mergedStakedMarketCoin,
|
|
1025
|
-
]);
|
|
1026
|
-
} else {
|
|
1027
|
-
toDestroyMarketCoin = mergedStakedMarketCoin;
|
|
1028
|
-
}
|
|
1009
|
+
// merge with takeMarketCoin
|
|
1010
|
+
if (toDestroyMarketCoin) {
|
|
1011
|
+
txBlock.mergeCoins(toDestroyMarketCoin, [stakedMarketCoin]);
|
|
1012
|
+
} else {
|
|
1013
|
+
toDestroyMarketCoin = stakedMarketCoin;
|
|
1029
1014
|
}
|
|
1030
1015
|
} catch (e: any) {
|
|
1031
1016
|
// ignore
|