@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.js
CHANGED
|
@@ -1261,7 +1261,7 @@ var queryMarket = async (query, indexer = false) => {
|
|
|
1261
1261
|
const parsedMarketCollateralData = parseOriginMarketCollateralData({
|
|
1262
1262
|
type: collateral.type,
|
|
1263
1263
|
collateralFactor: collateral.collateralFactor,
|
|
1264
|
-
liquidationFactor: collateral.
|
|
1264
|
+
liquidationFactor: collateral.liquidationFactor,
|
|
1265
1265
|
liquidationDiscount: collateral.liquidationDiscount,
|
|
1266
1266
|
liquidationPanelty: collateral.liquidationPanelty,
|
|
1267
1267
|
liquidationReserveFactor: collateral.liquidationReserveFactor,
|
|
@@ -4286,8 +4286,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
4286
4286
|
obligationAccessStore: builder.address.get("core.obligationAccessStore")
|
|
4287
4287
|
};
|
|
4288
4288
|
return {
|
|
4289
|
-
stakeObligation: (obligationId, obligaionKey
|
|
4290
|
-
const rewardCoinName =
|
|
4289
|
+
stakeObligation: (obligationId, obligaionKey) => {
|
|
4290
|
+
const rewardCoinName = "sui";
|
|
4291
4291
|
const rewardType = builder.utils.parseCoinType(rewardCoinName);
|
|
4292
4292
|
txBlock.moveCall(
|
|
4293
4293
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::stake`,
|
|
@@ -4302,8 +4302,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
4302
4302
|
[rewardType]
|
|
4303
4303
|
);
|
|
4304
4304
|
},
|
|
4305
|
-
unstakeObligation: (obligationId, obligaionKey
|
|
4306
|
-
const rewardCoinName =
|
|
4305
|
+
unstakeObligation: (obligationId, obligaionKey) => {
|
|
4306
|
+
const rewardCoinName = "sui";
|
|
4307
4307
|
const rewardType = builder.utils.parseCoinType(rewardCoinName);
|
|
4308
4308
|
txBlock.moveCall(
|
|
4309
4309
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
|
|
@@ -4336,7 +4336,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
4336
4336
|
};
|
|
4337
4337
|
var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
4338
4338
|
return {
|
|
4339
|
-
stakeObligationQuick: async (
|
|
4339
|
+
stakeObligationQuick: async (obligation, obligationKey) => {
|
|
4340
4340
|
const {
|
|
4341
4341
|
obligationId: obligationArg,
|
|
4342
4342
|
obligationKey: obligationtKeyArg,
|
|
@@ -4351,10 +4351,10 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
4351
4351
|
(txn) => txn.kind === "MoveCall" && txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`
|
|
4352
4352
|
);
|
|
4353
4353
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
4354
|
-
txBlock.stakeObligation(obligationArg, obligationtKeyArg
|
|
4354
|
+
txBlock.stakeObligation(obligationArg, obligationtKeyArg);
|
|
4355
4355
|
}
|
|
4356
4356
|
},
|
|
4357
|
-
unstakeObligationQuick: async (
|
|
4357
|
+
unstakeObligationQuick: async (obligation, obligationKey) => {
|
|
4358
4358
|
const {
|
|
4359
4359
|
obligationId: obligationArg,
|
|
4360
4360
|
obligationKey: obligationtKeyArg,
|
|
@@ -4366,7 +4366,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
4366
4366
|
obligationKey
|
|
4367
4367
|
);
|
|
4368
4368
|
if (obligationLocked) {
|
|
4369
|
-
txBlock.unstakeObligation(obligationArg, obligationtKeyArg
|
|
4369
|
+
txBlock.unstakeObligation(obligationArg, obligationtKeyArg);
|
|
4370
4370
|
}
|
|
4371
4371
|
},
|
|
4372
4372
|
claimBorrowIncentiveQuick: async (coinName, obligation, obligationKey) => {
|
|
@@ -4793,11 +4793,7 @@ var ScallopClient = class {
|
|
|
4793
4793
|
txBlock.setSender(sender);
|
|
4794
4794
|
const availableStake = SUPPORT_BORROW_INCENTIVE_POOLS.includes(poolCoinName);
|
|
4795
4795
|
if (sign && availableStake) {
|
|
4796
|
-
await txBlock.unstakeObligationQuick(
|
|
4797
|
-
poolCoinName,
|
|
4798
|
-
obligationId,
|
|
4799
|
-
obligationKey
|
|
4800
|
-
);
|
|
4796
|
+
await txBlock.unstakeObligationQuick(obligationId, obligationKey);
|
|
4801
4797
|
}
|
|
4802
4798
|
const coin = await txBlock.borrowQuick(
|
|
4803
4799
|
amount,
|
|
@@ -4807,11 +4803,7 @@ var ScallopClient = class {
|
|
|
4807
4803
|
);
|
|
4808
4804
|
txBlock.transferObjects([coin], sender);
|
|
4809
4805
|
if (sign && availableStake) {
|
|
4810
|
-
await txBlock.stakeObligationQuick(
|
|
4811
|
-
poolCoinName,
|
|
4812
|
-
obligationId,
|
|
4813
|
-
obligationKey
|
|
4814
|
-
);
|
|
4806
|
+
await txBlock.stakeObligationQuick(obligationId, obligationKey);
|
|
4815
4807
|
}
|
|
4816
4808
|
if (sign) {
|
|
4817
4809
|
return await this.suiKit.signAndSendTxn(
|
|
@@ -4837,19 +4829,11 @@ var ScallopClient = class {
|
|
|
4837
4829
|
txBlock.setSender(sender);
|
|
4838
4830
|
const availableStake = SUPPORT_BORROW_INCENTIVE_POOLS.includes(poolCoinName);
|
|
4839
4831
|
if (sign && availableStake) {
|
|
4840
|
-
await txBlock.unstakeObligationQuick(
|
|
4841
|
-
poolCoinName,
|
|
4842
|
-
obligationId,
|
|
4843
|
-
obligationKey
|
|
4844
|
-
);
|
|
4832
|
+
await txBlock.unstakeObligationQuick(obligationId, obligationKey);
|
|
4845
4833
|
}
|
|
4846
4834
|
await txBlock.repayQuick(amount, poolCoinName, obligationId);
|
|
4847
4835
|
if (sign && availableStake) {
|
|
4848
|
-
await txBlock.stakeObligationQuick(
|
|
4849
|
-
poolCoinName,
|
|
4850
|
-
obligationId,
|
|
4851
|
-
obligationKey
|
|
4852
|
-
);
|
|
4836
|
+
await txBlock.stakeObligationQuick(obligationId, obligationKey);
|
|
4853
4837
|
}
|
|
4854
4838
|
if (sign) {
|
|
4855
4839
|
return await this.suiKit.signAndSendTxn(
|
|
@@ -4971,17 +4955,17 @@ var ScallopClient = class {
|
|
|
4971
4955
|
/**
|
|
4972
4956
|
* stake obligaion.
|
|
4973
4957
|
*
|
|
4974
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
4975
4958
|
* @param obligaionId - The obligation account object.
|
|
4976
4959
|
* @param obligaionKeyId - The obligation key account object.
|
|
4960
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
4977
4961
|
* @param walletAddress - The wallet address of the owner.
|
|
4978
4962
|
* @return Transaction block response or transaction block
|
|
4979
4963
|
*/
|
|
4980
|
-
async stakeObligation(
|
|
4964
|
+
async stakeObligation(obligaionId, obligaionKeyId, sign = true, walletAddress) {
|
|
4981
4965
|
const txBlock = this.builder.createTxBlock();
|
|
4982
4966
|
const sender = walletAddress || this.walletAddress;
|
|
4983
4967
|
txBlock.setSender(sender);
|
|
4984
|
-
await txBlock.stakeObligationQuick(
|
|
4968
|
+
await txBlock.stakeObligationQuick(obligaionId, obligaionKeyId);
|
|
4985
4969
|
if (sign) {
|
|
4986
4970
|
return await this.suiKit.signAndSendTxn(
|
|
4987
4971
|
txBlock
|
|
@@ -4993,17 +4977,17 @@ var ScallopClient = class {
|
|
|
4993
4977
|
/**
|
|
4994
4978
|
* unstake obligaion.
|
|
4995
4979
|
*
|
|
4996
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
4997
4980
|
* @param obligaionId - The obligation account object.
|
|
4998
4981
|
* @param obligaionKeyId - The obligation key account object.
|
|
4982
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
4999
4983
|
* @param walletAddress - The wallet address of the owner.
|
|
5000
4984
|
* @return Transaction block response or transaction block
|
|
5001
4985
|
*/
|
|
5002
|
-
async unstakeObligation(
|
|
4986
|
+
async unstakeObligation(obligaionId, obligaionKeyId, sign = true, walletAddress) {
|
|
5003
4987
|
const txBlock = this.builder.createTxBlock();
|
|
5004
4988
|
const sender = walletAddress || this.walletAddress;
|
|
5005
4989
|
txBlock.setSender(sender);
|
|
5006
|
-
await txBlock.unstakeObligationQuick(
|
|
4990
|
+
await txBlock.unstakeObligationQuick(obligaionId, obligaionKeyId);
|
|
5007
4991
|
if (sign) {
|
|
5008
4992
|
return await this.suiKit.signAndSendTxn(
|
|
5009
4993
|
txBlock
|