@scallop-io/sui-scallop-sdk 0.46.46 → 0.46.47
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 +44 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -34
- package/dist/index.mjs.map +1 -1
- package/dist/types/builder/spool.d.ts +1 -1
- package/package.json +1 -1
- package/src/builders/spoolBuilder.ts +18 -16
- package/src/models/scallopClient.ts +32 -24
- package/src/types/builder/spool.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -5892,22 +5892,24 @@ var generateSpoolQuickMethod = ({
|
|
|
5892
5892
|
if (amount === 0)
|
|
5893
5893
|
break;
|
|
5894
5894
|
}
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
try {
|
|
5900
|
-
const existingCoins = await builder.utils.selectCoins(
|
|
5901
|
-
Number.MAX_SAFE_INTEGER,
|
|
5902
|
-
builder.utils.parseSCoinType(stakeMarketCoinName),
|
|
5903
|
-
requireSender(txBlock)
|
|
5904
|
-
);
|
|
5905
|
-
if (existingCoins.length > 0) {
|
|
5906
|
-
txBlock.mergeCoins(mergedSCoin, existingCoins);
|
|
5895
|
+
if (sCoins2.length > 0) {
|
|
5896
|
+
const mergedSCoin = sCoins2[0];
|
|
5897
|
+
if (sCoins2.length > 1) {
|
|
5898
|
+
txBlock.mergeCoins(mergedSCoin, sCoins2.slice(1));
|
|
5907
5899
|
}
|
|
5908
|
-
|
|
5900
|
+
try {
|
|
5901
|
+
const existingCoins = await builder.utils.selectCoins(
|
|
5902
|
+
Number.MAX_SAFE_INTEGER,
|
|
5903
|
+
builder.utils.parseSCoinType(stakeMarketCoinName),
|
|
5904
|
+
requireSender(txBlock)
|
|
5905
|
+
);
|
|
5906
|
+
if (existingCoins.length > 0) {
|
|
5907
|
+
txBlock.mergeCoins(mergedSCoin, existingCoins);
|
|
5908
|
+
}
|
|
5909
|
+
} catch (e) {
|
|
5910
|
+
}
|
|
5911
|
+
return mergedSCoin;
|
|
5909
5912
|
}
|
|
5910
|
-
return mergedSCoin;
|
|
5911
5913
|
},
|
|
5912
5914
|
claimQuick: async (stakeMarketCoinName, stakeAccountId) => {
|
|
5913
5915
|
const stakeAccountIds = await requireStakeAccountIds(
|
|
@@ -7330,8 +7332,10 @@ var ScallopClient = class {
|
|
|
7330
7332
|
stakeAccountId
|
|
7331
7333
|
);
|
|
7332
7334
|
const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
+
if (stakeMarketCoin) {
|
|
7336
|
+
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
7337
|
+
txBlock.transferObjects([coin], sender);
|
|
7338
|
+
}
|
|
7335
7339
|
if (sign) {
|
|
7336
7340
|
return await this.suiKit.signAndSendTxn(
|
|
7337
7341
|
txBlock
|
|
@@ -7446,6 +7450,7 @@ var ScallopClient = class {
|
|
|
7446
7450
|
const toTransfer = [];
|
|
7447
7451
|
await Promise.all(
|
|
7448
7452
|
SUPPORT_SCOIN.map(async (sCoinName) => {
|
|
7453
|
+
const sCoins2 = [];
|
|
7449
7454
|
let toDestroyMarketCoin;
|
|
7450
7455
|
try {
|
|
7451
7456
|
const marketCoins2 = await this.utils.selectCoins(
|
|
@@ -7463,23 +7468,6 @@ var ScallopClient = class {
|
|
|
7463
7468
|
if (!errMsg.includes("No valid coins found for the transaction"))
|
|
7464
7469
|
throw e;
|
|
7465
7470
|
}
|
|
7466
|
-
if (SUPPORT_SPOOLS.includes(sCoinName)) {
|
|
7467
|
-
try {
|
|
7468
|
-
const stakedMarketCoin = await txBlock.unstakeQuick(
|
|
7469
|
-
Number.MAX_SAFE_INTEGER,
|
|
7470
|
-
sCoinName
|
|
7471
|
-
);
|
|
7472
|
-
if (toDestroyMarketCoin) {
|
|
7473
|
-
txBlock.mergeCoins(toDestroyMarketCoin, [stakedMarketCoin]);
|
|
7474
|
-
} else {
|
|
7475
|
-
toDestroyMarketCoin = stakedMarketCoin;
|
|
7476
|
-
}
|
|
7477
|
-
} catch (e) {
|
|
7478
|
-
const errMsg = e.toString();
|
|
7479
|
-
if (!errMsg.includes("No stake account found"))
|
|
7480
|
-
throw e;
|
|
7481
|
-
}
|
|
7482
|
-
}
|
|
7483
7471
|
if (toDestroyMarketCoin) {
|
|
7484
7472
|
const sCoin = txBlock.mintSCoin(
|
|
7485
7473
|
sCoinName,
|
|
@@ -7501,7 +7489,29 @@ var ScallopClient = class {
|
|
|
7501
7489
|
if (!errMsg.includes("No valid coins found for the transaction"))
|
|
7502
7490
|
throw e;
|
|
7503
7491
|
}
|
|
7504
|
-
|
|
7492
|
+
sCoins2.push(sCoin);
|
|
7493
|
+
}
|
|
7494
|
+
if (SUPPORT_SPOOLS.includes(sCoinName)) {
|
|
7495
|
+
try {
|
|
7496
|
+
const sCoin = await txBlock.unstakeQuick(
|
|
7497
|
+
Number.MAX_SAFE_INTEGER,
|
|
7498
|
+
sCoinName
|
|
7499
|
+
);
|
|
7500
|
+
if (sCoin) {
|
|
7501
|
+
sCoins2.push(sCoin);
|
|
7502
|
+
}
|
|
7503
|
+
} catch (e) {
|
|
7504
|
+
const errMsg = e.toString();
|
|
7505
|
+
if (!errMsg.includes("No stake account found"))
|
|
7506
|
+
throw e;
|
|
7507
|
+
}
|
|
7508
|
+
}
|
|
7509
|
+
if (sCoins2.length > 0) {
|
|
7510
|
+
const mergedSCoin = sCoins2[0];
|
|
7511
|
+
if (sCoins2.length > 1) {
|
|
7512
|
+
txBlock.mergeCoins(mergedSCoin, sCoins2.slice(1));
|
|
7513
|
+
}
|
|
7514
|
+
toTransfer.push(mergedSCoin);
|
|
7505
7515
|
}
|
|
7506
7516
|
})
|
|
7507
7517
|
);
|