@scallop-io/sui-scallop-sdk 0.44.12 → 0.44.14
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 +19 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -35
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopClient.d.ts +4 -4
- package/dist/types/builder/borrowIncentive.d.ts +4 -4
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +12 -8
- package/src/models/scallopClient.ts +8 -26
- package/src/queries/coreQuery.ts +1 -1
- package/src/types/builder/borrowIncentive.ts +2 -6
package/dist/index.mjs
CHANGED
|
@@ -1197,7 +1197,7 @@ var queryMarket = async (query, indexer = false) => {
|
|
|
1197
1197
|
const parsedMarketCollateralData = parseOriginMarketCollateralData({
|
|
1198
1198
|
type: collateral.type,
|
|
1199
1199
|
collateralFactor: collateral.collateralFactor,
|
|
1200
|
-
liquidationFactor: collateral.
|
|
1200
|
+
liquidationFactor: collateral.liquidationFactor,
|
|
1201
1201
|
liquidationDiscount: collateral.liquidationDiscount,
|
|
1202
1202
|
liquidationPanelty: collateral.liquidationPanelty,
|
|
1203
1203
|
liquidationReserveFactor: collateral.liquidationReserveFactor,
|
|
@@ -4225,8 +4225,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
4225
4225
|
obligationAccessStore: builder.address.get("core.obligationAccessStore")
|
|
4226
4226
|
};
|
|
4227
4227
|
return {
|
|
4228
|
-
stakeObligation: (obligationId, obligaionKey
|
|
4229
|
-
const rewardCoinName =
|
|
4228
|
+
stakeObligation: (obligationId, obligaionKey) => {
|
|
4229
|
+
const rewardCoinName = "sui";
|
|
4230
4230
|
const rewardType = builder.utils.parseCoinType(rewardCoinName);
|
|
4231
4231
|
txBlock.moveCall(
|
|
4232
4232
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::stake`,
|
|
@@ -4241,8 +4241,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
4241
4241
|
[rewardType]
|
|
4242
4242
|
);
|
|
4243
4243
|
},
|
|
4244
|
-
unstakeObligation: (obligationId, obligaionKey
|
|
4245
|
-
const rewardCoinName =
|
|
4244
|
+
unstakeObligation: (obligationId, obligaionKey) => {
|
|
4245
|
+
const rewardCoinName = "sui";
|
|
4246
4246
|
const rewardType = builder.utils.parseCoinType(rewardCoinName);
|
|
4247
4247
|
txBlock.moveCall(
|
|
4248
4248
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
|
|
@@ -4275,7 +4275,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
4275
4275
|
};
|
|
4276
4276
|
var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
4277
4277
|
return {
|
|
4278
|
-
stakeObligationQuick: async (
|
|
4278
|
+
stakeObligationQuick: async (obligation, obligationKey) => {
|
|
4279
4279
|
const {
|
|
4280
4280
|
obligationId: obligationArg,
|
|
4281
4281
|
obligationKey: obligationtKeyArg,
|
|
@@ -4290,10 +4290,10 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
4290
4290
|
(txn) => txn.kind === "MoveCall" && txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`
|
|
4291
4291
|
);
|
|
4292
4292
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
4293
|
-
txBlock.stakeObligation(obligationArg, obligationtKeyArg
|
|
4293
|
+
txBlock.stakeObligation(obligationArg, obligationtKeyArg);
|
|
4294
4294
|
}
|
|
4295
4295
|
},
|
|
4296
|
-
unstakeObligationQuick: async (
|
|
4296
|
+
unstakeObligationQuick: async (obligation, obligationKey) => {
|
|
4297
4297
|
const {
|
|
4298
4298
|
obligationId: obligationArg,
|
|
4299
4299
|
obligationKey: obligationtKeyArg,
|
|
@@ -4305,7 +4305,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
4305
4305
|
obligationKey
|
|
4306
4306
|
);
|
|
4307
4307
|
if (obligationLocked) {
|
|
4308
|
-
txBlock.unstakeObligation(obligationArg, obligationtKeyArg
|
|
4308
|
+
txBlock.unstakeObligation(obligationArg, obligationtKeyArg);
|
|
4309
4309
|
}
|
|
4310
4310
|
},
|
|
4311
4311
|
claimBorrowIncentiveQuick: async (coinName, obligation, obligationKey) => {
|
|
@@ -4732,11 +4732,7 @@ var ScallopClient = class {
|
|
|
4732
4732
|
txBlock.setSender(sender);
|
|
4733
4733
|
const availableStake = SUPPORT_BORROW_INCENTIVE_POOLS.includes(poolCoinName);
|
|
4734
4734
|
if (sign && availableStake) {
|
|
4735
|
-
await txBlock.unstakeObligationQuick(
|
|
4736
|
-
poolCoinName,
|
|
4737
|
-
obligationId,
|
|
4738
|
-
obligationKey
|
|
4739
|
-
);
|
|
4735
|
+
await txBlock.unstakeObligationQuick(obligationId, obligationKey);
|
|
4740
4736
|
}
|
|
4741
4737
|
const coin = await txBlock.borrowQuick(
|
|
4742
4738
|
amount,
|
|
@@ -4746,11 +4742,7 @@ var ScallopClient = class {
|
|
|
4746
4742
|
);
|
|
4747
4743
|
txBlock.transferObjects([coin], sender);
|
|
4748
4744
|
if (sign && availableStake) {
|
|
4749
|
-
await txBlock.stakeObligationQuick(
|
|
4750
|
-
poolCoinName,
|
|
4751
|
-
obligationId,
|
|
4752
|
-
obligationKey
|
|
4753
|
-
);
|
|
4745
|
+
await txBlock.stakeObligationQuick(obligationId, obligationKey);
|
|
4754
4746
|
}
|
|
4755
4747
|
if (sign) {
|
|
4756
4748
|
return await this.suiKit.signAndSendTxn(
|
|
@@ -4776,19 +4768,11 @@ var ScallopClient = class {
|
|
|
4776
4768
|
txBlock.setSender(sender);
|
|
4777
4769
|
const availableStake = SUPPORT_BORROW_INCENTIVE_POOLS.includes(poolCoinName);
|
|
4778
4770
|
if (sign && availableStake) {
|
|
4779
|
-
await txBlock.unstakeObligationQuick(
|
|
4780
|
-
poolCoinName,
|
|
4781
|
-
obligationId,
|
|
4782
|
-
obligationKey
|
|
4783
|
-
);
|
|
4771
|
+
await txBlock.unstakeObligationQuick(obligationId, obligationKey);
|
|
4784
4772
|
}
|
|
4785
4773
|
await txBlock.repayQuick(amount, poolCoinName, obligationId);
|
|
4786
4774
|
if (sign && availableStake) {
|
|
4787
|
-
await txBlock.stakeObligationQuick(
|
|
4788
|
-
poolCoinName,
|
|
4789
|
-
obligationId,
|
|
4790
|
-
obligationKey
|
|
4791
|
-
);
|
|
4775
|
+
await txBlock.stakeObligationQuick(obligationId, obligationKey);
|
|
4792
4776
|
}
|
|
4793
4777
|
if (sign) {
|
|
4794
4778
|
return await this.suiKit.signAndSendTxn(
|
|
@@ -4910,17 +4894,17 @@ var ScallopClient = class {
|
|
|
4910
4894
|
/**
|
|
4911
4895
|
* stake obligaion.
|
|
4912
4896
|
*
|
|
4913
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
4914
4897
|
* @param obligaionId - The obligation account object.
|
|
4915
4898
|
* @param obligaionKeyId - The obligation key account object.
|
|
4899
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
4916
4900
|
* @param walletAddress - The wallet address of the owner.
|
|
4917
4901
|
* @return Transaction block response or transaction block
|
|
4918
4902
|
*/
|
|
4919
|
-
async stakeObligation(
|
|
4903
|
+
async stakeObligation(obligaionId, obligaionKeyId, sign = true, walletAddress) {
|
|
4920
4904
|
const txBlock = this.builder.createTxBlock();
|
|
4921
4905
|
const sender = walletAddress || this.walletAddress;
|
|
4922
4906
|
txBlock.setSender(sender);
|
|
4923
|
-
await txBlock.stakeObligationQuick(
|
|
4907
|
+
await txBlock.stakeObligationQuick(obligaionId, obligaionKeyId);
|
|
4924
4908
|
if (sign) {
|
|
4925
4909
|
return await this.suiKit.signAndSendTxn(
|
|
4926
4910
|
txBlock
|
|
@@ -4932,17 +4916,17 @@ var ScallopClient = class {
|
|
|
4932
4916
|
/**
|
|
4933
4917
|
* unstake obligaion.
|
|
4934
4918
|
*
|
|
4935
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
4936
4919
|
* @param obligaionId - The obligation account object.
|
|
4937
4920
|
* @param obligaionKeyId - The obligation key account object.
|
|
4921
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
4938
4922
|
* @param walletAddress - The wallet address of the owner.
|
|
4939
4923
|
* @return Transaction block response or transaction block
|
|
4940
4924
|
*/
|
|
4941
|
-
async unstakeObligation(
|
|
4925
|
+
async unstakeObligation(obligaionId, obligaionKeyId, sign = true, walletAddress) {
|
|
4942
4926
|
const txBlock = this.builder.createTxBlock();
|
|
4943
4927
|
const sender = walletAddress || this.walletAddress;
|
|
4944
4928
|
txBlock.setSender(sender);
|
|
4945
|
-
await txBlock.unstakeObligationQuick(
|
|
4929
|
+
await txBlock.unstakeObligationQuick(obligaionId, obligaionKeyId);
|
|
4946
4930
|
if (sign) {
|
|
4947
4931
|
return await this.suiKit.signAndSendTxn(
|
|
4948
4932
|
txBlock
|