@scallop-io/sui-scallop-sdk 1.4.2-rc.5 → 1.4.3-rc.1
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 +92 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +92 -96
- package/dist/index.mjs.map +1 -1
- package/dist/types/builder/borrowIncentive.d.ts +5 -5
- package/dist/types/builder/core.d.ts +15 -19
- package/dist/types/builder/loyaltyProgram.d.ts +1 -1
- package/dist/types/builder/referral.d.ts +4 -4
- package/dist/types/builder/sCoin.d.ts +2 -2
- package/dist/types/builder/spool.d.ts +4 -4
- package/dist/types/builder/vesca.d.ts +6 -6
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +16 -23
- package/src/builders/coreBuilder.ts +42 -40
- package/src/builders/loyaltyProgramBuilder.ts +2 -2
- package/src/builders/referralBuilder.ts +8 -11
- package/src/builders/sCoinBuilder.ts +4 -4
- package/src/builders/spoolBuilder.ts +11 -11
- package/src/builders/vescaBuilder.ts +12 -16
- package/src/models/scallopClient.ts +10 -15
- package/src/types/builder/borrowIncentive.ts +5 -8
- package/src/types/builder/core.ts +30 -17
- package/src/types/builder/loyaltyProgram.ts +1 -1
- package/src/types/builder/referral.ts +4 -6
- package/src/types/builder/sCoin.ts +2 -2
- package/src/types/builder/spool.ts +4 -4
- package/src/types/builder/vesca.ts +6 -9
package/dist/index.mjs
CHANGED
|
@@ -5991,40 +5991,40 @@ var generateCoreNormalMethod = ({
|
|
|
5991
5991
|
const referralPkgId = builder.address.get("referral.id");
|
|
5992
5992
|
const referralWitnessType = `${referralPkgId}::scallop_referral_program::REFERRAL_WITNESS`;
|
|
5993
5993
|
return {
|
|
5994
|
-
openObligation:
|
|
5995
|
-
const [obligation, obligationKey, obligationHotPotato] =
|
|
5994
|
+
openObligation: () => {
|
|
5995
|
+
const [obligation, obligationKey, obligationHotPotato] = builder.moveCall(
|
|
5996
5996
|
txBlock,
|
|
5997
5997
|
`${coreIds.protocolPkg}::open_obligation::open_obligation`,
|
|
5998
5998
|
[coreIds.version]
|
|
5999
5999
|
);
|
|
6000
6000
|
return [obligation, obligationKey, obligationHotPotato];
|
|
6001
6001
|
},
|
|
6002
|
-
returnObligation:
|
|
6003
|
-
|
|
6002
|
+
returnObligation: (obligation, obligationHotPotato) => {
|
|
6003
|
+
builder.moveCall(
|
|
6004
6004
|
txBlock,
|
|
6005
6005
|
`${coreIds.protocolPkg}::open_obligation::return_obligation`,
|
|
6006
6006
|
[coreIds.version, obligation, obligationHotPotato]
|
|
6007
6007
|
);
|
|
6008
6008
|
},
|
|
6009
|
-
openObligationEntry:
|
|
6010
|
-
|
|
6009
|
+
openObligationEntry: () => {
|
|
6010
|
+
builder.moveCall(
|
|
6011
6011
|
txBlock,
|
|
6012
6012
|
`${coreIds.protocolPkg}::open_obligation::open_obligation_entry`,
|
|
6013
6013
|
[coreIds.version]
|
|
6014
6014
|
);
|
|
6015
6015
|
},
|
|
6016
|
-
addCollateral:
|
|
6016
|
+
addCollateral: (obligation, coin, collateralCoinName) => {
|
|
6017
6017
|
const coinType = builder.utils.parseCoinType(collateralCoinName);
|
|
6018
|
-
|
|
6018
|
+
builder.moveCall(
|
|
6019
6019
|
txBlock,
|
|
6020
6020
|
`${coreIds.protocolPkg}::deposit_collateral::deposit_collateral`,
|
|
6021
6021
|
[coreIds.version, obligation, coreIds.market, coin],
|
|
6022
6022
|
[coinType]
|
|
6023
6023
|
);
|
|
6024
6024
|
},
|
|
6025
|
-
takeCollateral:
|
|
6025
|
+
takeCollateral: (obligation, obligationKey, amount, collateralCoinName) => {
|
|
6026
6026
|
const coinType = builder.utils.parseCoinType(collateralCoinName);
|
|
6027
|
-
return
|
|
6027
|
+
return builder.moveCall(
|
|
6028
6028
|
txBlock,
|
|
6029
6029
|
`${coreIds.protocolPkg}::withdraw_collateral::withdraw_collateral`,
|
|
6030
6030
|
[
|
|
@@ -6040,45 +6040,45 @@ var generateCoreNormalMethod = ({
|
|
|
6040
6040
|
[coinType]
|
|
6041
6041
|
);
|
|
6042
6042
|
},
|
|
6043
|
-
deposit:
|
|
6043
|
+
deposit: (coin, poolCoinName) => {
|
|
6044
6044
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6045
|
-
return
|
|
6045
|
+
return builder.moveCall(
|
|
6046
6046
|
txBlock,
|
|
6047
6047
|
`${coreIds.protocolPkg}::mint::mint`,
|
|
6048
6048
|
[coreIds.version, coreIds.market, coin, SUI_CLOCK_OBJECT_ID3],
|
|
6049
6049
|
[coinType]
|
|
6050
6050
|
);
|
|
6051
6051
|
},
|
|
6052
|
-
depositEntry:
|
|
6052
|
+
depositEntry: (coin, poolCoinName) => {
|
|
6053
6053
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6054
|
-
return
|
|
6054
|
+
return builder.moveCall(
|
|
6055
6055
|
txBlock,
|
|
6056
6056
|
`${coreIds.protocolPkg}::mint::mint_entry`,
|
|
6057
6057
|
[coreIds.version, coreIds.market, coin, SUI_CLOCK_OBJECT_ID3],
|
|
6058
6058
|
[coinType]
|
|
6059
6059
|
);
|
|
6060
6060
|
},
|
|
6061
|
-
withdraw:
|
|
6061
|
+
withdraw: (marketCoin, poolCoinName) => {
|
|
6062
6062
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6063
|
-
return
|
|
6063
|
+
return builder.moveCall(
|
|
6064
6064
|
txBlock,
|
|
6065
6065
|
`${coreIds.protocolPkg}::redeem::redeem`,
|
|
6066
6066
|
[coreIds.version, coreIds.market, marketCoin, SUI_CLOCK_OBJECT_ID3],
|
|
6067
6067
|
[coinType]
|
|
6068
6068
|
);
|
|
6069
6069
|
},
|
|
6070
|
-
withdrawEntry:
|
|
6070
|
+
withdrawEntry: (marketCoin, poolCoinName) => {
|
|
6071
6071
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6072
|
-
return
|
|
6072
|
+
return builder.moveCall(
|
|
6073
6073
|
txBlock,
|
|
6074
6074
|
`${coreIds.protocolPkg}::redeem::redeem_entry`,
|
|
6075
6075
|
[coreIds.version, coreIds.market, marketCoin, SUI_CLOCK_OBJECT_ID3],
|
|
6076
6076
|
[coinType]
|
|
6077
6077
|
);
|
|
6078
6078
|
},
|
|
6079
|
-
borrow:
|
|
6079
|
+
borrow: (obligation, obligationKey, amount, poolCoinName) => {
|
|
6080
6080
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6081
|
-
return
|
|
6081
|
+
return builder.moveCall(
|
|
6082
6082
|
txBlock,
|
|
6083
6083
|
`${coreIds.protocolPkg}::borrow::borrow`,
|
|
6084
6084
|
[
|
|
@@ -6094,9 +6094,9 @@ var generateCoreNormalMethod = ({
|
|
|
6094
6094
|
[coinType]
|
|
6095
6095
|
);
|
|
6096
6096
|
},
|
|
6097
|
-
borrowWithReferral:
|
|
6097
|
+
borrowWithReferral: (obligation, obligationKey, borrowReferral, amount, poolCoinName) => {
|
|
6098
6098
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6099
|
-
return
|
|
6099
|
+
return builder.moveCall(
|
|
6100
6100
|
txBlock,
|
|
6101
6101
|
`${coreIds.protocolPkg}::borrow::borrow_with_referral`,
|
|
6102
6102
|
[
|
|
@@ -6113,9 +6113,9 @@ var generateCoreNormalMethod = ({
|
|
|
6113
6113
|
[coinType, referralWitnessType]
|
|
6114
6114
|
);
|
|
6115
6115
|
},
|
|
6116
|
-
borrowEntry:
|
|
6116
|
+
borrowEntry: (obligation, obligationKey, amount, poolCoinName) => {
|
|
6117
6117
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6118
|
-
return
|
|
6118
|
+
return builder.moveCall(
|
|
6119
6119
|
txBlock,
|
|
6120
6120
|
`${coreIds.protocolPkg}::borrow::borrow_entry`,
|
|
6121
6121
|
[
|
|
@@ -6131,9 +6131,9 @@ var generateCoreNormalMethod = ({
|
|
|
6131
6131
|
[coinType]
|
|
6132
6132
|
);
|
|
6133
6133
|
},
|
|
6134
|
-
repay:
|
|
6134
|
+
repay: (obligation, coin, poolCoinName) => {
|
|
6135
6135
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6136
|
-
|
|
6136
|
+
builder.moveCall(
|
|
6137
6137
|
txBlock,
|
|
6138
6138
|
`${coreIds.protocolPkg}::repay::repay`,
|
|
6139
6139
|
[
|
|
@@ -6146,18 +6146,18 @@ var generateCoreNormalMethod = ({
|
|
|
6146
6146
|
[coinType]
|
|
6147
6147
|
);
|
|
6148
6148
|
},
|
|
6149
|
-
borrowFlashLoan:
|
|
6149
|
+
borrowFlashLoan: (amount, poolCoinName) => {
|
|
6150
6150
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6151
|
-
return
|
|
6151
|
+
return builder.moveCall(
|
|
6152
6152
|
txBlock,
|
|
6153
6153
|
`${coreIds.protocolPkg}::flash_loan::borrow_flash_loan`,
|
|
6154
6154
|
[coreIds.version, coreIds.market, amount],
|
|
6155
6155
|
[coinType]
|
|
6156
6156
|
);
|
|
6157
6157
|
},
|
|
6158
|
-
repayFlashLoan:
|
|
6158
|
+
repayFlashLoan: (coin, loan, poolCoinName) => {
|
|
6159
6159
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6160
|
-
|
|
6160
|
+
builder.moveCall(
|
|
6161
6161
|
txBlock,
|
|
6162
6162
|
`${coreIds.protocolPkg}::flash_loan::repay_flash_loan`,
|
|
6163
6163
|
[coreIds.version, coreIds.market, coin, loan],
|
|
@@ -6407,10 +6407,10 @@ var stakeHelper = async (builder, txBlock, stakeAccount, coinName, amount, sende
|
|
|
6407
6407
|
try {
|
|
6408
6408
|
const { takeCoin, leftCoin, totalAmount } = isSCoin ? await builder.selectSCoin(txBlock, coinName, amount, sender) : await builder.selectMarketCoin(txBlock, coinName, amount, sender);
|
|
6409
6409
|
if (isSCoin) {
|
|
6410
|
-
const marketCoin =
|
|
6411
|
-
|
|
6410
|
+
const marketCoin = txBlock.burnSCoin(coinName, takeCoin);
|
|
6411
|
+
txBlock.stake(stakeAccount, marketCoin, coinName);
|
|
6412
6412
|
} else {
|
|
6413
|
-
|
|
6413
|
+
txBlock.stake(stakeAccount, takeCoin, coinName);
|
|
6414
6414
|
}
|
|
6415
6415
|
txBlock.transferObjects([leftCoin], sender);
|
|
6416
6416
|
return totalAmount;
|
|
@@ -6426,43 +6426,43 @@ var generateSpoolNormalMethod = ({
|
|
|
6426
6426
|
spoolPkg: builder.address.get("spool.id")
|
|
6427
6427
|
};
|
|
6428
6428
|
return {
|
|
6429
|
-
createStakeAccount:
|
|
6429
|
+
createStakeAccount: (stakeMarketCoinName) => {
|
|
6430
6430
|
const marketCoinType = builder.utils.parseMarketCoinType(stakeMarketCoinName);
|
|
6431
6431
|
const stakePoolId = builder.address.get(
|
|
6432
6432
|
`spool.pools.${stakeMarketCoinName}.id`
|
|
6433
6433
|
);
|
|
6434
|
-
return
|
|
6434
|
+
return builder.moveCall(
|
|
6435
6435
|
txBlock,
|
|
6436
6436
|
`${spoolIds.spoolPkg}::user::new_spool_account`,
|
|
6437
6437
|
[stakePoolId, SUI_CLOCK_OBJECT_ID4],
|
|
6438
6438
|
[marketCoinType]
|
|
6439
6439
|
);
|
|
6440
6440
|
},
|
|
6441
|
-
stake:
|
|
6441
|
+
stake: (stakeAccount, coin, stakeMarketCoinName) => {
|
|
6442
6442
|
const marketCoinType = builder.utils.parseMarketCoinType(stakeMarketCoinName);
|
|
6443
6443
|
const stakePoolId = builder.address.get(
|
|
6444
6444
|
`spool.pools.${stakeMarketCoinName}.id`
|
|
6445
6445
|
);
|
|
6446
|
-
|
|
6446
|
+
builder.moveCall(
|
|
6447
6447
|
txBlock,
|
|
6448
6448
|
`${spoolIds.spoolPkg}::user::stake`,
|
|
6449
6449
|
[stakePoolId, stakeAccount, coin, SUI_CLOCK_OBJECT_ID4],
|
|
6450
6450
|
[marketCoinType]
|
|
6451
6451
|
);
|
|
6452
6452
|
},
|
|
6453
|
-
unstake:
|
|
6453
|
+
unstake: (stakeAccount, amount, stakeMarketCoinName) => {
|
|
6454
6454
|
const marketCoinType = builder.utils.parseMarketCoinType(stakeMarketCoinName);
|
|
6455
6455
|
const stakePoolId = builder.address.get(
|
|
6456
6456
|
`spool.pools.${stakeMarketCoinName}.id`
|
|
6457
6457
|
);
|
|
6458
|
-
return
|
|
6458
|
+
return builder.moveCall(
|
|
6459
6459
|
txBlock,
|
|
6460
6460
|
`${spoolIds.spoolPkg}::user::unstake`,
|
|
6461
6461
|
[stakePoolId, stakeAccount, amount, SUI_CLOCK_OBJECT_ID4],
|
|
6462
6462
|
[marketCoinType]
|
|
6463
6463
|
);
|
|
6464
6464
|
},
|
|
6465
|
-
claim:
|
|
6465
|
+
claim: (stakeAccount, stakeMarketCoinName) => {
|
|
6466
6466
|
const stakePoolId = builder.address.get(
|
|
6467
6467
|
`spool.pools.${stakeMarketCoinName}.id`
|
|
6468
6468
|
);
|
|
@@ -6472,7 +6472,7 @@ var generateSpoolNormalMethod = ({
|
|
|
6472
6472
|
const marketCoinType = builder.utils.parseMarketCoinType(stakeMarketCoinName);
|
|
6473
6473
|
const rewardCoinName = spoolRewardCoins[stakeMarketCoinName];
|
|
6474
6474
|
const rewardCoinType = builder.utils.parseCoinType(rewardCoinName);
|
|
6475
|
-
return
|
|
6475
|
+
return builder.moveCall(
|
|
6476
6476
|
txBlock,
|
|
6477
6477
|
`${spoolIds.spoolPkg}::user::redeem_rewards`,
|
|
6478
6478
|
[stakePoolId, rewardPoolId, stakeAccount, SUI_CLOCK_OBJECT_ID4],
|
|
@@ -6652,8 +6652,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6652
6652
|
config: builder.address.get("vesca.config")
|
|
6653
6653
|
};
|
|
6654
6654
|
return {
|
|
6655
|
-
stakeObligation:
|
|
6656
|
-
|
|
6655
|
+
stakeObligation: (obligationId, obligationKey) => {
|
|
6656
|
+
builder.moveCall(
|
|
6657
6657
|
txBlock,
|
|
6658
6658
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::stake`,
|
|
6659
6659
|
[
|
|
@@ -6667,8 +6667,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6667
6667
|
]
|
|
6668
6668
|
);
|
|
6669
6669
|
},
|
|
6670
|
-
stakeObligationWithVesca:
|
|
6671
|
-
|
|
6670
|
+
stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
|
|
6671
|
+
builder.moveCall(
|
|
6672
6672
|
txBlock,
|
|
6673
6673
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca`,
|
|
6674
6674
|
[
|
|
@@ -6687,8 +6687,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6687
6687
|
[]
|
|
6688
6688
|
);
|
|
6689
6689
|
},
|
|
6690
|
-
unstakeObligation:
|
|
6691
|
-
|
|
6690
|
+
unstakeObligation: (obligationId, obligationKey) => {
|
|
6691
|
+
builder.moveCall(
|
|
6692
6692
|
txBlock,
|
|
6693
6693
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
|
|
6694
6694
|
[
|
|
@@ -6701,9 +6701,9 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6701
6701
|
]
|
|
6702
6702
|
);
|
|
6703
6703
|
},
|
|
6704
|
-
claimBorrowIncentive:
|
|
6704
|
+
claimBorrowIncentive: (obligationId, obligationKey, rewardCoinName) => {
|
|
6705
6705
|
const rewardType = builder.utils.parseCoinType(rewardCoinName);
|
|
6706
|
-
return
|
|
6706
|
+
return builder.moveCall(
|
|
6707
6707
|
txBlock,
|
|
6708
6708
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::redeem_rewards`,
|
|
6709
6709
|
[
|
|
@@ -6717,8 +6717,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6717
6717
|
[rewardType]
|
|
6718
6718
|
);
|
|
6719
6719
|
},
|
|
6720
|
-
deactivateBoost:
|
|
6721
|
-
|
|
6720
|
+
deactivateBoost: (obligation, veScaKey) => {
|
|
6721
|
+
builder.moveCall(
|
|
6722
6722
|
txBlock,
|
|
6723
6723
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
|
|
6724
6724
|
[
|
|
@@ -6750,7 +6750,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
6750
6750
|
(txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
|
|
6751
6751
|
);
|
|
6752
6752
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
6753
|
-
|
|
6753
|
+
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
6754
6754
|
}
|
|
6755
6755
|
},
|
|
6756
6756
|
stakeObligationWithVeScaQuick: async (obligation, obligationKey, veScaKey) => {
|
|
@@ -6771,9 +6771,9 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
6771
6771
|
const bindedVeScaKey = await builder.query.getBindedVeScaKey(obligationArg);
|
|
6772
6772
|
const _veScaKey = bindedVeScaKey ?? veScaKey;
|
|
6773
6773
|
if (!_veScaKey) {
|
|
6774
|
-
|
|
6774
|
+
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
6775
6775
|
} else {
|
|
6776
|
-
|
|
6776
|
+
txBlock.stakeObligationWithVesca(
|
|
6777
6777
|
obligationArg,
|
|
6778
6778
|
obligationKeyArg,
|
|
6779
6779
|
_veScaKey
|
|
@@ -6793,7 +6793,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
6793
6793
|
obligationKey
|
|
6794
6794
|
);
|
|
6795
6795
|
if (obligationLocked) {
|
|
6796
|
-
|
|
6796
|
+
txBlock.unstakeObligation(obligationArg, obligationKeyArg);
|
|
6797
6797
|
}
|
|
6798
6798
|
},
|
|
6799
6799
|
claimBorrowIncentiveQuick: async (rewardCoinName, obligation, obligationKey) => {
|
|
@@ -6803,7 +6803,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
6803
6803
|
obligation,
|
|
6804
6804
|
obligationKey
|
|
6805
6805
|
);
|
|
6806
|
-
return
|
|
6806
|
+
return txBlock.claimBorrowIncentive(
|
|
6807
6807
|
obligationArg,
|
|
6808
6808
|
obligationKeyArg,
|
|
6809
6809
|
rewardCoinName
|
|
@@ -6872,8 +6872,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6872
6872
|
config: builder.address.get("vesca.config")
|
|
6873
6873
|
};
|
|
6874
6874
|
return {
|
|
6875
|
-
lockSca:
|
|
6876
|
-
return
|
|
6875
|
+
lockSca: (scaCoin, unlockAtInSecondTimestamp) => {
|
|
6876
|
+
return builder.moveCall(
|
|
6877
6877
|
txBlock,
|
|
6878
6878
|
`${veScaIds.pkgId}::ve_sca::mint_ve_sca_key`,
|
|
6879
6879
|
[
|
|
@@ -6887,8 +6887,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6887
6887
|
[]
|
|
6888
6888
|
);
|
|
6889
6889
|
},
|
|
6890
|
-
extendLockPeriod:
|
|
6891
|
-
|
|
6890
|
+
extendLockPeriod: (veScaKey, newUnlockAtInSecondTimestamp) => {
|
|
6891
|
+
builder.moveCall(
|
|
6892
6892
|
txBlock,
|
|
6893
6893
|
`${veScaIds.pkgId}::ve_sca::extend_lock_period`,
|
|
6894
6894
|
[
|
|
@@ -6902,8 +6902,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6902
6902
|
[]
|
|
6903
6903
|
);
|
|
6904
6904
|
},
|
|
6905
|
-
extendLockAmount:
|
|
6906
|
-
|
|
6905
|
+
extendLockAmount: (veScaKey, scaCoin) => {
|
|
6906
|
+
builder.moveCall(
|
|
6907
6907
|
txBlock,
|
|
6908
6908
|
`${veScaIds.pkgId}::ve_sca::lock_more_sca`,
|
|
6909
6909
|
[
|
|
@@ -6917,8 +6917,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6917
6917
|
[]
|
|
6918
6918
|
);
|
|
6919
6919
|
},
|
|
6920
|
-
renewExpiredVeSca:
|
|
6921
|
-
|
|
6920
|
+
renewExpiredVeSca: (veScaKey, scaCoin, newUnlockAtInSecondTimestamp) => {
|
|
6921
|
+
builder.moveCall(
|
|
6922
6922
|
txBlock,
|
|
6923
6923
|
`${veScaIds.pkgId}::ve_sca::renew_expired_ve_sca`,
|
|
6924
6924
|
[
|
|
@@ -6933,8 +6933,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6933
6933
|
[]
|
|
6934
6934
|
);
|
|
6935
6935
|
},
|
|
6936
|
-
redeemSca:
|
|
6937
|
-
return
|
|
6936
|
+
redeemSca: (veScaKey) => {
|
|
6937
|
+
return builder.moveCall(
|
|
6938
6938
|
txBlock,
|
|
6939
6939
|
`${veScaIds.pkgId}::ve_sca::redeem`,
|
|
6940
6940
|
[
|
|
@@ -6947,8 +6947,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6947
6947
|
[]
|
|
6948
6948
|
);
|
|
6949
6949
|
},
|
|
6950
|
-
mintEmptyVeSca:
|
|
6951
|
-
return
|
|
6950
|
+
mintEmptyVeSca: () => {
|
|
6951
|
+
return builder.moveCall(
|
|
6952
6952
|
txBlock,
|
|
6953
6953
|
`${veScaIds.pkgId}::ve_sca::mint_ve_sca_placeholder_key`,
|
|
6954
6954
|
[veScaIds.config, veScaIds.table],
|
|
@@ -7147,8 +7147,8 @@ var generateReferralNormalMethod = ({
|
|
|
7147
7147
|
};
|
|
7148
7148
|
const veScaTable = builder.address.get("vesca.table");
|
|
7149
7149
|
return {
|
|
7150
|
-
bindToReferral:
|
|
7151
|
-
|
|
7150
|
+
bindToReferral: (veScaKeyId) => {
|
|
7151
|
+
builder.moveCall(
|
|
7152
7152
|
txBlock,
|
|
7153
7153
|
`${referralIds.referralPgkId}::referral_bindings::bind_ve_sca_referrer`,
|
|
7154
7154
|
[
|
|
@@ -7160,9 +7160,9 @@ var generateReferralNormalMethod = ({
|
|
|
7160
7160
|
[]
|
|
7161
7161
|
);
|
|
7162
7162
|
},
|
|
7163
|
-
claimReferralTicket:
|
|
7163
|
+
claimReferralTicket: (poolCoinName) => {
|
|
7164
7164
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
7165
|
-
return
|
|
7165
|
+
return builder.moveCall(
|
|
7166
7166
|
txBlock,
|
|
7167
7167
|
`${referralIds.referralPgkId}::scallop_referral_program::claim_ve_sca_referral_ticket`,
|
|
7168
7168
|
[
|
|
@@ -7176,9 +7176,9 @@ var generateReferralNormalMethod = ({
|
|
|
7176
7176
|
[coinType]
|
|
7177
7177
|
);
|
|
7178
7178
|
},
|
|
7179
|
-
burnReferralTicket:
|
|
7179
|
+
burnReferralTicket: (ticket, poolCoinName) => {
|
|
7180
7180
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
7181
|
-
|
|
7181
|
+
builder.moveCall(
|
|
7182
7182
|
txBlock,
|
|
7183
7183
|
`${referralIds.referralPgkId}::scallop_referral_program::burn_ve_sca_referral_ticket`,
|
|
7184
7184
|
[
|
|
@@ -7190,9 +7190,9 @@ var generateReferralNormalMethod = ({
|
|
|
7190
7190
|
[coinType]
|
|
7191
7191
|
);
|
|
7192
7192
|
},
|
|
7193
|
-
claimReferralRevenue:
|
|
7193
|
+
claimReferralRevenue: (veScaKey, poolCoinName) => {
|
|
7194
7194
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
7195
|
-
return
|
|
7195
|
+
return builder.moveCall(
|
|
7196
7196
|
txBlock,
|
|
7197
7197
|
`${referralIds.referralPgkId}::referral_revenue_pool::claim_revenue_with_ve_sca_key`,
|
|
7198
7198
|
[
|
|
@@ -7285,8 +7285,8 @@ var generateLoyaltyProgramNormalMethod = ({ builder, txBlock }) => {
|
|
|
7285
7285
|
)
|
|
7286
7286
|
};
|
|
7287
7287
|
return {
|
|
7288
|
-
claimLoyaltyRevenue:
|
|
7289
|
-
return
|
|
7288
|
+
claimLoyaltyRevenue: (veScaKey) => {
|
|
7289
|
+
return builder.moveCall(
|
|
7290
7290
|
txBlock,
|
|
7291
7291
|
`${loyaltyProgramIds.loyaltyProgramPkgId}::reward_pool::redeem_reward`,
|
|
7292
7292
|
[loyaltyProgramIds.rewardPool, veScaKey]
|
|
@@ -7353,8 +7353,8 @@ var generateSCoinNormalMethod = ({
|
|
|
7353
7353
|
pkgId: builder.address.get("scoin.id")
|
|
7354
7354
|
};
|
|
7355
7355
|
return {
|
|
7356
|
-
mintSCoin:
|
|
7357
|
-
return
|
|
7356
|
+
mintSCoin: (marketCoinName, marketCoin) => {
|
|
7357
|
+
return builder.moveCall(
|
|
7358
7358
|
txBlock,
|
|
7359
7359
|
`${sCoinPkgIds.pkgId}::s_coin_converter::mint_s_coin`,
|
|
7360
7360
|
[builder.utils.getSCoinTreasury(marketCoinName), marketCoin],
|
|
@@ -7364,8 +7364,8 @@ var generateSCoinNormalMethod = ({
|
|
|
7364
7364
|
]
|
|
7365
7365
|
);
|
|
7366
7366
|
},
|
|
7367
|
-
burnSCoin:
|
|
7368
|
-
return
|
|
7367
|
+
burnSCoin: (sCoinName, sCoin) => {
|
|
7368
|
+
return builder.moveCall(
|
|
7369
7369
|
txBlock,
|
|
7370
7370
|
`${sCoinPkgIds.pkgId}::s_coin_converter::burn_s_coin`,
|
|
7371
7371
|
[builder.utils.getSCoinTreasury(sCoinName), sCoin],
|
|
@@ -8516,7 +8516,7 @@ var ScallopClient = class {
|
|
|
8516
8516
|
}
|
|
8517
8517
|
async openObligation(sign = true) {
|
|
8518
8518
|
const txBlock = this.builder.createTxBlock();
|
|
8519
|
-
|
|
8519
|
+
txBlock.openObligationEntry();
|
|
8520
8520
|
if (sign) {
|
|
8521
8521
|
return await this.suiKit.signAndSendTxn(
|
|
8522
8522
|
txBlock
|
|
@@ -8538,9 +8538,9 @@ var ScallopClient = class {
|
|
|
8538
8538
|
specificObligationId
|
|
8539
8539
|
);
|
|
8540
8540
|
} else {
|
|
8541
|
-
const [obligation, obligationKey, hotPotato] =
|
|
8541
|
+
const [obligation, obligationKey, hotPotato] = txBlock.openObligation();
|
|
8542
8542
|
await txBlock.addCollateralQuick(amount, collateralCoinName, obligation);
|
|
8543
|
-
|
|
8543
|
+
txBlock.returnObligation(obligation, hotPotato);
|
|
8544
8544
|
txBlock.transferObjects([obligationKey], sender);
|
|
8545
8545
|
}
|
|
8546
8546
|
if (sign) {
|
|
@@ -8610,7 +8610,7 @@ var ScallopClient = class {
|
|
|
8610
8610
|
targetStakeAccount
|
|
8611
8611
|
);
|
|
8612
8612
|
} else {
|
|
8613
|
-
const account =
|
|
8613
|
+
const account = txBlock.createStakeAccount(stakeMarketCoinName);
|
|
8614
8614
|
await txBlock.stakeQuick(marketCoin, stakeMarketCoinName, account);
|
|
8615
8615
|
txBlock.transferObjects([account], sender);
|
|
8616
8616
|
}
|
|
@@ -8707,12 +8707,8 @@ var ScallopClient = class {
|
|
|
8707
8707
|
const txBlock = this.builder.createTxBlock();
|
|
8708
8708
|
const sender = walletAddress ?? this.walletAddress;
|
|
8709
8709
|
txBlock.setSender(sender);
|
|
8710
|
-
const [coin, loan] =
|
|
8711
|
-
|
|
8712
|
-
await callback(txBlock, coin),
|
|
8713
|
-
loan,
|
|
8714
|
-
poolCoinName
|
|
8715
|
-
);
|
|
8710
|
+
const [coin, loan] = txBlock.borrowFlashLoan(amount, poolCoinName);
|
|
8711
|
+
txBlock.repayFlashLoan(await callback(txBlock, coin), loan, poolCoinName);
|
|
8716
8712
|
if (sign) {
|
|
8717
8713
|
return await this.suiKit.signAndSendTxn(
|
|
8718
8714
|
txBlock
|
|
@@ -8725,7 +8721,7 @@ var ScallopClient = class {
|
|
|
8725
8721
|
const txBlock = this.builder.createTxBlock();
|
|
8726
8722
|
const sender = walletAddress ?? this.walletAddress;
|
|
8727
8723
|
txBlock.setSender(sender);
|
|
8728
|
-
const stakeAccount =
|
|
8724
|
+
const stakeAccount = txBlock.createStakeAccount(marketCoinName);
|
|
8729
8725
|
txBlock.transferObjects([stakeAccount], sender);
|
|
8730
8726
|
if (sign) {
|
|
8731
8727
|
return await this.suiKit.signAndSendTxn(
|
|
@@ -8744,7 +8740,7 @@ var ScallopClient = class {
|
|
|
8744
8740
|
if (targetStakeAccount) {
|
|
8745
8741
|
await txBlock.stakeQuick(amount, stakeMarketCoinName, targetStakeAccount);
|
|
8746
8742
|
} else {
|
|
8747
|
-
const account =
|
|
8743
|
+
const account = txBlock.createStakeAccount(stakeMarketCoinName);
|
|
8748
8744
|
await txBlock.stakeQuick(amount, stakeMarketCoinName, account);
|
|
8749
8745
|
txBlock.transferObjects([account], sender);
|
|
8750
8746
|
}
|
|
@@ -8794,7 +8790,7 @@ var ScallopClient = class {
|
|
|
8794
8790
|
);
|
|
8795
8791
|
const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
|
|
8796
8792
|
if (stakeMarketCoin) {
|
|
8797
|
-
const coin =
|
|
8793
|
+
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
8798
8794
|
await this.utils.mergeSimilarCoins(
|
|
8799
8795
|
txBlock,
|
|
8800
8796
|
coin,
|
|
@@ -8955,7 +8951,7 @@ var ScallopClient = class {
|
|
|
8955
8951
|
throw e;
|
|
8956
8952
|
}
|
|
8957
8953
|
if (toDestroyMarketCoin) {
|
|
8958
|
-
const sCoin =
|
|
8954
|
+
const sCoin = txBlock.mintSCoin(
|
|
8959
8955
|
sCoinName,
|
|
8960
8956
|
toDestroyMarketCoin
|
|
8961
8957
|
);
|