@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.mjs
CHANGED
|
@@ -5821,22 +5821,24 @@ var generateSpoolQuickMethod = ({
|
|
|
5821
5821
|
if (amount === 0)
|
|
5822
5822
|
break;
|
|
5823
5823
|
}
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
try {
|
|
5829
|
-
const existingCoins = await builder.utils.selectCoins(
|
|
5830
|
-
Number.MAX_SAFE_INTEGER,
|
|
5831
|
-
builder.utils.parseSCoinType(stakeMarketCoinName),
|
|
5832
|
-
requireSender(txBlock)
|
|
5833
|
-
);
|
|
5834
|
-
if (existingCoins.length > 0) {
|
|
5835
|
-
txBlock.mergeCoins(mergedSCoin, existingCoins);
|
|
5824
|
+
if (sCoins2.length > 0) {
|
|
5825
|
+
const mergedSCoin = sCoins2[0];
|
|
5826
|
+
if (sCoins2.length > 1) {
|
|
5827
|
+
txBlock.mergeCoins(mergedSCoin, sCoins2.slice(1));
|
|
5836
5828
|
}
|
|
5837
|
-
|
|
5829
|
+
try {
|
|
5830
|
+
const existingCoins = await builder.utils.selectCoins(
|
|
5831
|
+
Number.MAX_SAFE_INTEGER,
|
|
5832
|
+
builder.utils.parseSCoinType(stakeMarketCoinName),
|
|
5833
|
+
requireSender(txBlock)
|
|
5834
|
+
);
|
|
5835
|
+
if (existingCoins.length > 0) {
|
|
5836
|
+
txBlock.mergeCoins(mergedSCoin, existingCoins);
|
|
5837
|
+
}
|
|
5838
|
+
} catch (e) {
|
|
5839
|
+
}
|
|
5840
|
+
return mergedSCoin;
|
|
5838
5841
|
}
|
|
5839
|
-
return mergedSCoin;
|
|
5840
5842
|
},
|
|
5841
5843
|
claimQuick: async (stakeMarketCoinName, stakeAccountId) => {
|
|
5842
5844
|
const stakeAccountIds = await requireStakeAccountIds(
|
|
@@ -7246,12 +7248,12 @@ var ScallopClient = class {
|
|
|
7246
7248
|
const txBlock = this.builder.createTxBlock();
|
|
7247
7249
|
const sender = walletAddress || this.walletAddress;
|
|
7248
7250
|
txBlock.setSender(sender);
|
|
7249
|
-
const
|
|
7251
|
+
const marketCoin = await txBlock.unstakeQuick(
|
|
7250
7252
|
amount,
|
|
7251
7253
|
stakeMarketCoinName,
|
|
7252
7254
|
stakeAccountId
|
|
7253
7255
|
);
|
|
7254
|
-
txBlock.transferObjects(
|
|
7256
|
+
txBlock.transferObjects([marketCoin], sender);
|
|
7255
7257
|
if (sign) {
|
|
7256
7258
|
return await this.suiKit.signAndSendTxn(
|
|
7257
7259
|
txBlock
|
|
@@ -7264,18 +7266,16 @@ var ScallopClient = class {
|
|
|
7264
7266
|
const txBlock = this.builder.createTxBlock();
|
|
7265
7267
|
const sender = walletAddress || this.walletAddress;
|
|
7266
7268
|
txBlock.setSender(sender);
|
|
7267
|
-
const
|
|
7269
|
+
const stakeMarketCoin = await txBlock.unstakeQuick(
|
|
7268
7270
|
amount,
|
|
7269
7271
|
stakeMarketCoinName,
|
|
7270
7272
|
stakeAccountId
|
|
7271
7273
|
);
|
|
7272
|
-
const
|
|
7273
|
-
|
|
7274
|
-
const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
|
|
7274
|
+
const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
|
|
7275
|
+
if (stakeMarketCoin) {
|
|
7275
7276
|
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
7276
|
-
|
|
7277
|
+
txBlock.transferObjects([coin], sender);
|
|
7277
7278
|
}
|
|
7278
|
-
txBlock.transferObjects(coins, sender);
|
|
7279
7279
|
if (sign) {
|
|
7280
7280
|
return await this.suiKit.signAndSendTxn(
|
|
7281
7281
|
txBlock
|
|
@@ -7390,6 +7390,7 @@ var ScallopClient = class {
|
|
|
7390
7390
|
const toTransfer = [];
|
|
7391
7391
|
await Promise.all(
|
|
7392
7392
|
SUPPORT_SCOIN.map(async (sCoinName) => {
|
|
7393
|
+
const sCoins2 = [];
|
|
7393
7394
|
let toDestroyMarketCoin;
|
|
7394
7395
|
try {
|
|
7395
7396
|
const marketCoins2 = await this.utils.selectCoins(
|
|
@@ -7407,23 +7408,6 @@ var ScallopClient = class {
|
|
|
7407
7408
|
if (!errMsg.includes("No valid coins found for the transaction"))
|
|
7408
7409
|
throw e;
|
|
7409
7410
|
}
|
|
7410
|
-
if (SUPPORT_SPOOLS.includes(sCoinName)) {
|
|
7411
|
-
try {
|
|
7412
|
-
const stakedMarketCoin = await txBlock.unstakeQuick(
|
|
7413
|
-
Number.MAX_SAFE_INTEGER,
|
|
7414
|
-
sCoinName
|
|
7415
|
-
);
|
|
7416
|
-
if (toDestroyMarketCoin) {
|
|
7417
|
-
txBlock.mergeCoins(toDestroyMarketCoin, [stakedMarketCoin]);
|
|
7418
|
-
} else {
|
|
7419
|
-
toDestroyMarketCoin = stakedMarketCoin;
|
|
7420
|
-
}
|
|
7421
|
-
} catch (e) {
|
|
7422
|
-
const errMsg = e.toString();
|
|
7423
|
-
if (!errMsg.includes("No stake account found"))
|
|
7424
|
-
throw e;
|
|
7425
|
-
}
|
|
7426
|
-
}
|
|
7427
7411
|
if (toDestroyMarketCoin) {
|
|
7428
7412
|
const sCoin = txBlock.mintSCoin(
|
|
7429
7413
|
sCoinName,
|
|
@@ -7445,7 +7429,29 @@ var ScallopClient = class {
|
|
|
7445
7429
|
if (!errMsg.includes("No valid coins found for the transaction"))
|
|
7446
7430
|
throw e;
|
|
7447
7431
|
}
|
|
7448
|
-
|
|
7432
|
+
sCoins2.push(sCoin);
|
|
7433
|
+
}
|
|
7434
|
+
if (SUPPORT_SPOOLS.includes(sCoinName)) {
|
|
7435
|
+
try {
|
|
7436
|
+
const sCoin = await txBlock.unstakeQuick(
|
|
7437
|
+
Number.MAX_SAFE_INTEGER,
|
|
7438
|
+
sCoinName
|
|
7439
|
+
);
|
|
7440
|
+
if (sCoin) {
|
|
7441
|
+
sCoins2.push(sCoin);
|
|
7442
|
+
}
|
|
7443
|
+
} catch (e) {
|
|
7444
|
+
const errMsg = e.toString();
|
|
7445
|
+
if (!errMsg.includes("No stake account found"))
|
|
7446
|
+
throw e;
|
|
7447
|
+
}
|
|
7448
|
+
}
|
|
7449
|
+
if (sCoins2.length > 0) {
|
|
7450
|
+
const mergedSCoin = sCoins2[0];
|
|
7451
|
+
if (sCoins2.length > 1) {
|
|
7452
|
+
txBlock.mergeCoins(mergedSCoin, sCoins2.slice(1));
|
|
7453
|
+
}
|
|
7454
|
+
toTransfer.push(mergedSCoin);
|
|
7449
7455
|
}
|
|
7450
7456
|
})
|
|
7451
7457
|
);
|