@scallop-io/sui-scallop-sdk 0.46.45 → 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 +46 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -40
- 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 +35 -31
- 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(
|
|
@@ -7306,12 +7308,12 @@ var ScallopClient = class {
|
|
|
7306
7308
|
const txBlock = this.builder.createTxBlock();
|
|
7307
7309
|
const sender = walletAddress || this.walletAddress;
|
|
7308
7310
|
txBlock.setSender(sender);
|
|
7309
|
-
const
|
|
7311
|
+
const marketCoin = await txBlock.unstakeQuick(
|
|
7310
7312
|
amount,
|
|
7311
7313
|
stakeMarketCoinName,
|
|
7312
7314
|
stakeAccountId
|
|
7313
7315
|
);
|
|
7314
|
-
txBlock.transferObjects(
|
|
7316
|
+
txBlock.transferObjects([marketCoin], sender);
|
|
7315
7317
|
if (sign) {
|
|
7316
7318
|
return await this.suiKit.signAndSendTxn(
|
|
7317
7319
|
txBlock
|
|
@@ -7324,18 +7326,16 @@ var ScallopClient = class {
|
|
|
7324
7326
|
const txBlock = this.builder.createTxBlock();
|
|
7325
7327
|
const sender = walletAddress || this.walletAddress;
|
|
7326
7328
|
txBlock.setSender(sender);
|
|
7327
|
-
const
|
|
7329
|
+
const stakeMarketCoin = await txBlock.unstakeQuick(
|
|
7328
7330
|
amount,
|
|
7329
7331
|
stakeMarketCoinName,
|
|
7330
7332
|
stakeAccountId
|
|
7331
7333
|
);
|
|
7332
|
-
const
|
|
7333
|
-
|
|
7334
|
-
const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
|
|
7334
|
+
const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
|
|
7335
|
+
if (stakeMarketCoin) {
|
|
7335
7336
|
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
7336
|
-
|
|
7337
|
+
txBlock.transferObjects([coin], sender);
|
|
7337
7338
|
}
|
|
7338
|
-
txBlock.transferObjects(coins, sender);
|
|
7339
7339
|
if (sign) {
|
|
7340
7340
|
return await this.suiKit.signAndSendTxn(
|
|
7341
7341
|
txBlock
|
|
@@ -7450,6 +7450,7 @@ var ScallopClient = class {
|
|
|
7450
7450
|
const toTransfer = [];
|
|
7451
7451
|
await Promise.all(
|
|
7452
7452
|
SUPPORT_SCOIN.map(async (sCoinName) => {
|
|
7453
|
+
const sCoins2 = [];
|
|
7453
7454
|
let toDestroyMarketCoin;
|
|
7454
7455
|
try {
|
|
7455
7456
|
const marketCoins2 = await this.utils.selectCoins(
|
|
@@ -7467,23 +7468,6 @@ var ScallopClient = class {
|
|
|
7467
7468
|
if (!errMsg.includes("No valid coins found for the transaction"))
|
|
7468
7469
|
throw e;
|
|
7469
7470
|
}
|
|
7470
|
-
if (SUPPORT_SPOOLS.includes(sCoinName)) {
|
|
7471
|
-
try {
|
|
7472
|
-
const stakedMarketCoin = await txBlock.unstakeQuick(
|
|
7473
|
-
Number.MAX_SAFE_INTEGER,
|
|
7474
|
-
sCoinName
|
|
7475
|
-
);
|
|
7476
|
-
if (toDestroyMarketCoin) {
|
|
7477
|
-
txBlock.mergeCoins(toDestroyMarketCoin, [stakedMarketCoin]);
|
|
7478
|
-
} else {
|
|
7479
|
-
toDestroyMarketCoin = stakedMarketCoin;
|
|
7480
|
-
}
|
|
7481
|
-
} catch (e) {
|
|
7482
|
-
const errMsg = e.toString();
|
|
7483
|
-
if (!errMsg.includes("No stake account found"))
|
|
7484
|
-
throw e;
|
|
7485
|
-
}
|
|
7486
|
-
}
|
|
7487
7471
|
if (toDestroyMarketCoin) {
|
|
7488
7472
|
const sCoin = txBlock.mintSCoin(
|
|
7489
7473
|
sCoinName,
|
|
@@ -7505,7 +7489,29 @@ var ScallopClient = class {
|
|
|
7505
7489
|
if (!errMsg.includes("No valid coins found for the transaction"))
|
|
7506
7490
|
throw e;
|
|
7507
7491
|
}
|
|
7508
|
-
|
|
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);
|
|
7509
7515
|
}
|
|
7510
7516
|
})
|
|
7511
7517
|
);
|