@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.js
CHANGED
|
@@ -6078,40 +6078,40 @@ var generateCoreNormalMethod = ({
|
|
|
6078
6078
|
const referralPkgId = builder.address.get("referral.id");
|
|
6079
6079
|
const referralWitnessType = `${referralPkgId}::scallop_referral_program::REFERRAL_WITNESS`;
|
|
6080
6080
|
return {
|
|
6081
|
-
openObligation:
|
|
6082
|
-
const [obligation, obligationKey, obligationHotPotato] =
|
|
6081
|
+
openObligation: () => {
|
|
6082
|
+
const [obligation, obligationKey, obligationHotPotato] = builder.moveCall(
|
|
6083
6083
|
txBlock,
|
|
6084
6084
|
`${coreIds.protocolPkg}::open_obligation::open_obligation`,
|
|
6085
6085
|
[coreIds.version]
|
|
6086
6086
|
);
|
|
6087
6087
|
return [obligation, obligationKey, obligationHotPotato];
|
|
6088
6088
|
},
|
|
6089
|
-
returnObligation:
|
|
6090
|
-
|
|
6089
|
+
returnObligation: (obligation, obligationHotPotato) => {
|
|
6090
|
+
builder.moveCall(
|
|
6091
6091
|
txBlock,
|
|
6092
6092
|
`${coreIds.protocolPkg}::open_obligation::return_obligation`,
|
|
6093
6093
|
[coreIds.version, obligation, obligationHotPotato]
|
|
6094
6094
|
);
|
|
6095
6095
|
},
|
|
6096
|
-
openObligationEntry:
|
|
6097
|
-
|
|
6096
|
+
openObligationEntry: () => {
|
|
6097
|
+
builder.moveCall(
|
|
6098
6098
|
txBlock,
|
|
6099
6099
|
`${coreIds.protocolPkg}::open_obligation::open_obligation_entry`,
|
|
6100
6100
|
[coreIds.version]
|
|
6101
6101
|
);
|
|
6102
6102
|
},
|
|
6103
|
-
addCollateral:
|
|
6103
|
+
addCollateral: (obligation, coin, collateralCoinName) => {
|
|
6104
6104
|
const coinType = builder.utils.parseCoinType(collateralCoinName);
|
|
6105
|
-
|
|
6105
|
+
builder.moveCall(
|
|
6106
6106
|
txBlock,
|
|
6107
6107
|
`${coreIds.protocolPkg}::deposit_collateral::deposit_collateral`,
|
|
6108
6108
|
[coreIds.version, obligation, coreIds.market, coin],
|
|
6109
6109
|
[coinType]
|
|
6110
6110
|
);
|
|
6111
6111
|
},
|
|
6112
|
-
takeCollateral:
|
|
6112
|
+
takeCollateral: (obligation, obligationKey, amount, collateralCoinName) => {
|
|
6113
6113
|
const coinType = builder.utils.parseCoinType(collateralCoinName);
|
|
6114
|
-
return
|
|
6114
|
+
return builder.moveCall(
|
|
6115
6115
|
txBlock,
|
|
6116
6116
|
`${coreIds.protocolPkg}::withdraw_collateral::withdraw_collateral`,
|
|
6117
6117
|
[
|
|
@@ -6127,45 +6127,45 @@ var generateCoreNormalMethod = ({
|
|
|
6127
6127
|
[coinType]
|
|
6128
6128
|
);
|
|
6129
6129
|
},
|
|
6130
|
-
deposit:
|
|
6130
|
+
deposit: (coin, poolCoinName) => {
|
|
6131
6131
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6132
|
-
return
|
|
6132
|
+
return builder.moveCall(
|
|
6133
6133
|
txBlock,
|
|
6134
6134
|
`${coreIds.protocolPkg}::mint::mint`,
|
|
6135
6135
|
[coreIds.version, coreIds.market, coin, import_utils14.SUI_CLOCK_OBJECT_ID],
|
|
6136
6136
|
[coinType]
|
|
6137
6137
|
);
|
|
6138
6138
|
},
|
|
6139
|
-
depositEntry:
|
|
6139
|
+
depositEntry: (coin, poolCoinName) => {
|
|
6140
6140
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6141
|
-
return
|
|
6141
|
+
return builder.moveCall(
|
|
6142
6142
|
txBlock,
|
|
6143
6143
|
`${coreIds.protocolPkg}::mint::mint_entry`,
|
|
6144
6144
|
[coreIds.version, coreIds.market, coin, import_utils14.SUI_CLOCK_OBJECT_ID],
|
|
6145
6145
|
[coinType]
|
|
6146
6146
|
);
|
|
6147
6147
|
},
|
|
6148
|
-
withdraw:
|
|
6148
|
+
withdraw: (marketCoin, poolCoinName) => {
|
|
6149
6149
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6150
|
-
return
|
|
6150
|
+
return builder.moveCall(
|
|
6151
6151
|
txBlock,
|
|
6152
6152
|
`${coreIds.protocolPkg}::redeem::redeem`,
|
|
6153
6153
|
[coreIds.version, coreIds.market, marketCoin, import_utils14.SUI_CLOCK_OBJECT_ID],
|
|
6154
6154
|
[coinType]
|
|
6155
6155
|
);
|
|
6156
6156
|
},
|
|
6157
|
-
withdrawEntry:
|
|
6157
|
+
withdrawEntry: (marketCoin, poolCoinName) => {
|
|
6158
6158
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6159
|
-
return
|
|
6159
|
+
return builder.moveCall(
|
|
6160
6160
|
txBlock,
|
|
6161
6161
|
`${coreIds.protocolPkg}::redeem::redeem_entry`,
|
|
6162
6162
|
[coreIds.version, coreIds.market, marketCoin, import_utils14.SUI_CLOCK_OBJECT_ID],
|
|
6163
6163
|
[coinType]
|
|
6164
6164
|
);
|
|
6165
6165
|
},
|
|
6166
|
-
borrow:
|
|
6166
|
+
borrow: (obligation, obligationKey, amount, poolCoinName) => {
|
|
6167
6167
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6168
|
-
return
|
|
6168
|
+
return builder.moveCall(
|
|
6169
6169
|
txBlock,
|
|
6170
6170
|
`${coreIds.protocolPkg}::borrow::borrow`,
|
|
6171
6171
|
[
|
|
@@ -6181,9 +6181,9 @@ var generateCoreNormalMethod = ({
|
|
|
6181
6181
|
[coinType]
|
|
6182
6182
|
);
|
|
6183
6183
|
},
|
|
6184
|
-
borrowWithReferral:
|
|
6184
|
+
borrowWithReferral: (obligation, obligationKey, borrowReferral, amount, poolCoinName) => {
|
|
6185
6185
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6186
|
-
return
|
|
6186
|
+
return builder.moveCall(
|
|
6187
6187
|
txBlock,
|
|
6188
6188
|
`${coreIds.protocolPkg}::borrow::borrow_with_referral`,
|
|
6189
6189
|
[
|
|
@@ -6200,9 +6200,9 @@ var generateCoreNormalMethod = ({
|
|
|
6200
6200
|
[coinType, referralWitnessType]
|
|
6201
6201
|
);
|
|
6202
6202
|
},
|
|
6203
|
-
borrowEntry:
|
|
6203
|
+
borrowEntry: (obligation, obligationKey, amount, poolCoinName) => {
|
|
6204
6204
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6205
|
-
return
|
|
6205
|
+
return builder.moveCall(
|
|
6206
6206
|
txBlock,
|
|
6207
6207
|
`${coreIds.protocolPkg}::borrow::borrow_entry`,
|
|
6208
6208
|
[
|
|
@@ -6218,9 +6218,9 @@ var generateCoreNormalMethod = ({
|
|
|
6218
6218
|
[coinType]
|
|
6219
6219
|
);
|
|
6220
6220
|
},
|
|
6221
|
-
repay:
|
|
6221
|
+
repay: (obligation, coin, poolCoinName) => {
|
|
6222
6222
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6223
|
-
|
|
6223
|
+
builder.moveCall(
|
|
6224
6224
|
txBlock,
|
|
6225
6225
|
`${coreIds.protocolPkg}::repay::repay`,
|
|
6226
6226
|
[
|
|
@@ -6233,18 +6233,18 @@ var generateCoreNormalMethod = ({
|
|
|
6233
6233
|
[coinType]
|
|
6234
6234
|
);
|
|
6235
6235
|
},
|
|
6236
|
-
borrowFlashLoan:
|
|
6236
|
+
borrowFlashLoan: (amount, poolCoinName) => {
|
|
6237
6237
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6238
|
-
return
|
|
6238
|
+
return builder.moveCall(
|
|
6239
6239
|
txBlock,
|
|
6240
6240
|
`${coreIds.protocolPkg}::flash_loan::borrow_flash_loan`,
|
|
6241
6241
|
[coreIds.version, coreIds.market, amount],
|
|
6242
6242
|
[coinType]
|
|
6243
6243
|
);
|
|
6244
6244
|
},
|
|
6245
|
-
repayFlashLoan:
|
|
6245
|
+
repayFlashLoan: (coin, loan, poolCoinName) => {
|
|
6246
6246
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
6247
|
-
|
|
6247
|
+
builder.moveCall(
|
|
6248
6248
|
txBlock,
|
|
6249
6249
|
`${coreIds.protocolPkg}::flash_loan::repay_flash_loan`,
|
|
6250
6250
|
[coreIds.version, coreIds.market, coin, loan],
|
|
@@ -6494,10 +6494,10 @@ var stakeHelper = async (builder, txBlock, stakeAccount, coinName, amount, sende
|
|
|
6494
6494
|
try {
|
|
6495
6495
|
const { takeCoin, leftCoin, totalAmount } = isSCoin ? await builder.selectSCoin(txBlock, coinName, amount, sender) : await builder.selectMarketCoin(txBlock, coinName, amount, sender);
|
|
6496
6496
|
if (isSCoin) {
|
|
6497
|
-
const marketCoin =
|
|
6498
|
-
|
|
6497
|
+
const marketCoin = txBlock.burnSCoin(coinName, takeCoin);
|
|
6498
|
+
txBlock.stake(stakeAccount, marketCoin, coinName);
|
|
6499
6499
|
} else {
|
|
6500
|
-
|
|
6500
|
+
txBlock.stake(stakeAccount, takeCoin, coinName);
|
|
6501
6501
|
}
|
|
6502
6502
|
txBlock.transferObjects([leftCoin], sender);
|
|
6503
6503
|
return totalAmount;
|
|
@@ -6513,43 +6513,43 @@ var generateSpoolNormalMethod = ({
|
|
|
6513
6513
|
spoolPkg: builder.address.get("spool.id")
|
|
6514
6514
|
};
|
|
6515
6515
|
return {
|
|
6516
|
-
createStakeAccount:
|
|
6516
|
+
createStakeAccount: (stakeMarketCoinName) => {
|
|
6517
6517
|
const marketCoinType = builder.utils.parseMarketCoinType(stakeMarketCoinName);
|
|
6518
6518
|
const stakePoolId = builder.address.get(
|
|
6519
6519
|
`spool.pools.${stakeMarketCoinName}.id`
|
|
6520
6520
|
);
|
|
6521
|
-
return
|
|
6521
|
+
return builder.moveCall(
|
|
6522
6522
|
txBlock,
|
|
6523
6523
|
`${spoolIds.spoolPkg}::user::new_spool_account`,
|
|
6524
6524
|
[stakePoolId, import_utils16.SUI_CLOCK_OBJECT_ID],
|
|
6525
6525
|
[marketCoinType]
|
|
6526
6526
|
);
|
|
6527
6527
|
},
|
|
6528
|
-
stake:
|
|
6528
|
+
stake: (stakeAccount, coin, stakeMarketCoinName) => {
|
|
6529
6529
|
const marketCoinType = builder.utils.parseMarketCoinType(stakeMarketCoinName);
|
|
6530
6530
|
const stakePoolId = builder.address.get(
|
|
6531
6531
|
`spool.pools.${stakeMarketCoinName}.id`
|
|
6532
6532
|
);
|
|
6533
|
-
|
|
6533
|
+
builder.moveCall(
|
|
6534
6534
|
txBlock,
|
|
6535
6535
|
`${spoolIds.spoolPkg}::user::stake`,
|
|
6536
6536
|
[stakePoolId, stakeAccount, coin, import_utils16.SUI_CLOCK_OBJECT_ID],
|
|
6537
6537
|
[marketCoinType]
|
|
6538
6538
|
);
|
|
6539
6539
|
},
|
|
6540
|
-
unstake:
|
|
6540
|
+
unstake: (stakeAccount, amount, stakeMarketCoinName) => {
|
|
6541
6541
|
const marketCoinType = builder.utils.parseMarketCoinType(stakeMarketCoinName);
|
|
6542
6542
|
const stakePoolId = builder.address.get(
|
|
6543
6543
|
`spool.pools.${stakeMarketCoinName}.id`
|
|
6544
6544
|
);
|
|
6545
|
-
return
|
|
6545
|
+
return builder.moveCall(
|
|
6546
6546
|
txBlock,
|
|
6547
6547
|
`${spoolIds.spoolPkg}::user::unstake`,
|
|
6548
6548
|
[stakePoolId, stakeAccount, amount, import_utils16.SUI_CLOCK_OBJECT_ID],
|
|
6549
6549
|
[marketCoinType]
|
|
6550
6550
|
);
|
|
6551
6551
|
},
|
|
6552
|
-
claim:
|
|
6552
|
+
claim: (stakeAccount, stakeMarketCoinName) => {
|
|
6553
6553
|
const stakePoolId = builder.address.get(
|
|
6554
6554
|
`spool.pools.${stakeMarketCoinName}.id`
|
|
6555
6555
|
);
|
|
@@ -6559,7 +6559,7 @@ var generateSpoolNormalMethod = ({
|
|
|
6559
6559
|
const marketCoinType = builder.utils.parseMarketCoinType(stakeMarketCoinName);
|
|
6560
6560
|
const rewardCoinName = spoolRewardCoins[stakeMarketCoinName];
|
|
6561
6561
|
const rewardCoinType = builder.utils.parseCoinType(rewardCoinName);
|
|
6562
|
-
return
|
|
6562
|
+
return builder.moveCall(
|
|
6563
6563
|
txBlock,
|
|
6564
6564
|
`${spoolIds.spoolPkg}::user::redeem_rewards`,
|
|
6565
6565
|
[stakePoolId, rewardPoolId, stakeAccount, import_utils16.SUI_CLOCK_OBJECT_ID],
|
|
@@ -6739,8 +6739,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6739
6739
|
config: builder.address.get("vesca.config")
|
|
6740
6740
|
};
|
|
6741
6741
|
return {
|
|
6742
|
-
stakeObligation:
|
|
6743
|
-
|
|
6742
|
+
stakeObligation: (obligationId, obligationKey) => {
|
|
6743
|
+
builder.moveCall(
|
|
6744
6744
|
txBlock,
|
|
6745
6745
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::stake`,
|
|
6746
6746
|
[
|
|
@@ -6754,8 +6754,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6754
6754
|
]
|
|
6755
6755
|
);
|
|
6756
6756
|
},
|
|
6757
|
-
stakeObligationWithVesca:
|
|
6758
|
-
|
|
6757
|
+
stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
|
|
6758
|
+
builder.moveCall(
|
|
6759
6759
|
txBlock,
|
|
6760
6760
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca`,
|
|
6761
6761
|
[
|
|
@@ -6774,8 +6774,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6774
6774
|
[]
|
|
6775
6775
|
);
|
|
6776
6776
|
},
|
|
6777
|
-
unstakeObligation:
|
|
6778
|
-
|
|
6777
|
+
unstakeObligation: (obligationId, obligationKey) => {
|
|
6778
|
+
builder.moveCall(
|
|
6779
6779
|
txBlock,
|
|
6780
6780
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
|
|
6781
6781
|
[
|
|
@@ -6788,9 +6788,9 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6788
6788
|
]
|
|
6789
6789
|
);
|
|
6790
6790
|
},
|
|
6791
|
-
claimBorrowIncentive:
|
|
6791
|
+
claimBorrowIncentive: (obligationId, obligationKey, rewardCoinName) => {
|
|
6792
6792
|
const rewardType = builder.utils.parseCoinType(rewardCoinName);
|
|
6793
|
-
return
|
|
6793
|
+
return builder.moveCall(
|
|
6794
6794
|
txBlock,
|
|
6795
6795
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::redeem_rewards`,
|
|
6796
6796
|
[
|
|
@@ -6804,8 +6804,8 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
6804
6804
|
[rewardType]
|
|
6805
6805
|
);
|
|
6806
6806
|
},
|
|
6807
|
-
deactivateBoost:
|
|
6808
|
-
|
|
6807
|
+
deactivateBoost: (obligation, veScaKey) => {
|
|
6808
|
+
builder.moveCall(
|
|
6809
6809
|
txBlock,
|
|
6810
6810
|
`${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
|
|
6811
6811
|
[
|
|
@@ -6837,7 +6837,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
6837
6837
|
(txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
|
|
6838
6838
|
);
|
|
6839
6839
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
6840
|
-
|
|
6840
|
+
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
6841
6841
|
}
|
|
6842
6842
|
},
|
|
6843
6843
|
stakeObligationWithVeScaQuick: async (obligation, obligationKey, veScaKey) => {
|
|
@@ -6858,9 +6858,9 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
6858
6858
|
const bindedVeScaKey = await builder.query.getBindedVeScaKey(obligationArg);
|
|
6859
6859
|
const _veScaKey = bindedVeScaKey ?? veScaKey;
|
|
6860
6860
|
if (!_veScaKey) {
|
|
6861
|
-
|
|
6861
|
+
txBlock.stakeObligation(obligationArg, obligationKeyArg);
|
|
6862
6862
|
} else {
|
|
6863
|
-
|
|
6863
|
+
txBlock.stakeObligationWithVesca(
|
|
6864
6864
|
obligationArg,
|
|
6865
6865
|
obligationKeyArg,
|
|
6866
6866
|
_veScaKey
|
|
@@ -6880,7 +6880,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
6880
6880
|
obligationKey
|
|
6881
6881
|
);
|
|
6882
6882
|
if (obligationLocked) {
|
|
6883
|
-
|
|
6883
|
+
txBlock.unstakeObligation(obligationArg, obligationKeyArg);
|
|
6884
6884
|
}
|
|
6885
6885
|
},
|
|
6886
6886
|
claimBorrowIncentiveQuick: async (rewardCoinName, obligation, obligationKey) => {
|
|
@@ -6890,7 +6890,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
6890
6890
|
obligation,
|
|
6891
6891
|
obligationKey
|
|
6892
6892
|
);
|
|
6893
|
-
return
|
|
6893
|
+
return txBlock.claimBorrowIncentive(
|
|
6894
6894
|
obligationArg,
|
|
6895
6895
|
obligationKeyArg,
|
|
6896
6896
|
rewardCoinName
|
|
@@ -6955,8 +6955,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6955
6955
|
config: builder.address.get("vesca.config")
|
|
6956
6956
|
};
|
|
6957
6957
|
return {
|
|
6958
|
-
lockSca:
|
|
6959
|
-
return
|
|
6958
|
+
lockSca: (scaCoin, unlockAtInSecondTimestamp) => {
|
|
6959
|
+
return builder.moveCall(
|
|
6960
6960
|
txBlock,
|
|
6961
6961
|
`${veScaIds.pkgId}::ve_sca::mint_ve_sca_key`,
|
|
6962
6962
|
[
|
|
@@ -6970,8 +6970,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6970
6970
|
[]
|
|
6971
6971
|
);
|
|
6972
6972
|
},
|
|
6973
|
-
extendLockPeriod:
|
|
6974
|
-
|
|
6973
|
+
extendLockPeriod: (veScaKey, newUnlockAtInSecondTimestamp) => {
|
|
6974
|
+
builder.moveCall(
|
|
6975
6975
|
txBlock,
|
|
6976
6976
|
`${veScaIds.pkgId}::ve_sca::extend_lock_period`,
|
|
6977
6977
|
[
|
|
@@ -6985,8 +6985,8 @@ var generateNormalVeScaMethod = ({
|
|
|
6985
6985
|
[]
|
|
6986
6986
|
);
|
|
6987
6987
|
},
|
|
6988
|
-
extendLockAmount:
|
|
6989
|
-
|
|
6988
|
+
extendLockAmount: (veScaKey, scaCoin) => {
|
|
6989
|
+
builder.moveCall(
|
|
6990
6990
|
txBlock,
|
|
6991
6991
|
`${veScaIds.pkgId}::ve_sca::lock_more_sca`,
|
|
6992
6992
|
[
|
|
@@ -7000,8 +7000,8 @@ var generateNormalVeScaMethod = ({
|
|
|
7000
7000
|
[]
|
|
7001
7001
|
);
|
|
7002
7002
|
},
|
|
7003
|
-
renewExpiredVeSca:
|
|
7004
|
-
|
|
7003
|
+
renewExpiredVeSca: (veScaKey, scaCoin, newUnlockAtInSecondTimestamp) => {
|
|
7004
|
+
builder.moveCall(
|
|
7005
7005
|
txBlock,
|
|
7006
7006
|
`${veScaIds.pkgId}::ve_sca::renew_expired_ve_sca`,
|
|
7007
7007
|
[
|
|
@@ -7016,8 +7016,8 @@ var generateNormalVeScaMethod = ({
|
|
|
7016
7016
|
[]
|
|
7017
7017
|
);
|
|
7018
7018
|
},
|
|
7019
|
-
redeemSca:
|
|
7020
|
-
return
|
|
7019
|
+
redeemSca: (veScaKey) => {
|
|
7020
|
+
return builder.moveCall(
|
|
7021
7021
|
txBlock,
|
|
7022
7022
|
`${veScaIds.pkgId}::ve_sca::redeem`,
|
|
7023
7023
|
[
|
|
@@ -7030,8 +7030,8 @@ var generateNormalVeScaMethod = ({
|
|
|
7030
7030
|
[]
|
|
7031
7031
|
);
|
|
7032
7032
|
},
|
|
7033
|
-
mintEmptyVeSca:
|
|
7034
|
-
return
|
|
7033
|
+
mintEmptyVeSca: () => {
|
|
7034
|
+
return builder.moveCall(
|
|
7035
7035
|
txBlock,
|
|
7036
7036
|
`${veScaIds.pkgId}::ve_sca::mint_ve_sca_placeholder_key`,
|
|
7037
7037
|
[veScaIds.config, veScaIds.table],
|
|
@@ -7226,8 +7226,8 @@ var generateReferralNormalMethod = ({
|
|
|
7226
7226
|
};
|
|
7227
7227
|
const veScaTable = builder.address.get("vesca.table");
|
|
7228
7228
|
return {
|
|
7229
|
-
bindToReferral:
|
|
7230
|
-
|
|
7229
|
+
bindToReferral: (veScaKeyId) => {
|
|
7230
|
+
builder.moveCall(
|
|
7231
7231
|
txBlock,
|
|
7232
7232
|
`${referralIds.referralPgkId}::referral_bindings::bind_ve_sca_referrer`,
|
|
7233
7233
|
[
|
|
@@ -7239,9 +7239,9 @@ var generateReferralNormalMethod = ({
|
|
|
7239
7239
|
[]
|
|
7240
7240
|
);
|
|
7241
7241
|
},
|
|
7242
|
-
claimReferralTicket:
|
|
7242
|
+
claimReferralTicket: (poolCoinName) => {
|
|
7243
7243
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
7244
|
-
return
|
|
7244
|
+
return builder.moveCall(
|
|
7245
7245
|
txBlock,
|
|
7246
7246
|
`${referralIds.referralPgkId}::scallop_referral_program::claim_ve_sca_referral_ticket`,
|
|
7247
7247
|
[
|
|
@@ -7255,9 +7255,9 @@ var generateReferralNormalMethod = ({
|
|
|
7255
7255
|
[coinType]
|
|
7256
7256
|
);
|
|
7257
7257
|
},
|
|
7258
|
-
burnReferralTicket:
|
|
7258
|
+
burnReferralTicket: (ticket, poolCoinName) => {
|
|
7259
7259
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
7260
|
-
|
|
7260
|
+
builder.moveCall(
|
|
7261
7261
|
txBlock,
|
|
7262
7262
|
`${referralIds.referralPgkId}::scallop_referral_program::burn_ve_sca_referral_ticket`,
|
|
7263
7263
|
[
|
|
@@ -7269,9 +7269,9 @@ var generateReferralNormalMethod = ({
|
|
|
7269
7269
|
[coinType]
|
|
7270
7270
|
);
|
|
7271
7271
|
},
|
|
7272
|
-
claimReferralRevenue:
|
|
7272
|
+
claimReferralRevenue: (veScaKey, poolCoinName) => {
|
|
7273
7273
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
7274
|
-
return
|
|
7274
|
+
return builder.moveCall(
|
|
7275
7275
|
txBlock,
|
|
7276
7276
|
`${referralIds.referralPgkId}::referral_revenue_pool::claim_revenue_with_ve_sca_key`,
|
|
7277
7277
|
[
|
|
@@ -7364,8 +7364,8 @@ var generateLoyaltyProgramNormalMethod = ({ builder, txBlock }) => {
|
|
|
7364
7364
|
)
|
|
7365
7365
|
};
|
|
7366
7366
|
return {
|
|
7367
|
-
claimLoyaltyRevenue:
|
|
7368
|
-
return
|
|
7367
|
+
claimLoyaltyRevenue: (veScaKey) => {
|
|
7368
|
+
return builder.moveCall(
|
|
7369
7369
|
txBlock,
|
|
7370
7370
|
`${loyaltyProgramIds.loyaltyProgramPkgId}::reward_pool::redeem_reward`,
|
|
7371
7371
|
[loyaltyProgramIds.rewardPool, veScaKey]
|
|
@@ -7432,8 +7432,8 @@ var generateSCoinNormalMethod = ({
|
|
|
7432
7432
|
pkgId: builder.address.get("scoin.id")
|
|
7433
7433
|
};
|
|
7434
7434
|
return {
|
|
7435
|
-
mintSCoin:
|
|
7436
|
-
return
|
|
7435
|
+
mintSCoin: (marketCoinName, marketCoin) => {
|
|
7436
|
+
return builder.moveCall(
|
|
7437
7437
|
txBlock,
|
|
7438
7438
|
`${sCoinPkgIds.pkgId}::s_coin_converter::mint_s_coin`,
|
|
7439
7439
|
[builder.utils.getSCoinTreasury(marketCoinName), marketCoin],
|
|
@@ -7443,8 +7443,8 @@ var generateSCoinNormalMethod = ({
|
|
|
7443
7443
|
]
|
|
7444
7444
|
);
|
|
7445
7445
|
},
|
|
7446
|
-
burnSCoin:
|
|
7447
|
-
return
|
|
7446
|
+
burnSCoin: (sCoinName, sCoin) => {
|
|
7447
|
+
return builder.moveCall(
|
|
7448
7448
|
txBlock,
|
|
7449
7449
|
`${sCoinPkgIds.pkgId}::s_coin_converter::burn_s_coin`,
|
|
7450
7450
|
[builder.utils.getSCoinTreasury(sCoinName), sCoin],
|
|
@@ -8595,7 +8595,7 @@ var ScallopClient = class {
|
|
|
8595
8595
|
}
|
|
8596
8596
|
async openObligation(sign = true) {
|
|
8597
8597
|
const txBlock = this.builder.createTxBlock();
|
|
8598
|
-
|
|
8598
|
+
txBlock.openObligationEntry();
|
|
8599
8599
|
if (sign) {
|
|
8600
8600
|
return await this.suiKit.signAndSendTxn(
|
|
8601
8601
|
txBlock
|
|
@@ -8617,9 +8617,9 @@ var ScallopClient = class {
|
|
|
8617
8617
|
specificObligationId
|
|
8618
8618
|
);
|
|
8619
8619
|
} else {
|
|
8620
|
-
const [obligation, obligationKey, hotPotato] =
|
|
8620
|
+
const [obligation, obligationKey, hotPotato] = txBlock.openObligation();
|
|
8621
8621
|
await txBlock.addCollateralQuick(amount, collateralCoinName, obligation);
|
|
8622
|
-
|
|
8622
|
+
txBlock.returnObligation(obligation, hotPotato);
|
|
8623
8623
|
txBlock.transferObjects([obligationKey], sender);
|
|
8624
8624
|
}
|
|
8625
8625
|
if (sign) {
|
|
@@ -8689,7 +8689,7 @@ var ScallopClient = class {
|
|
|
8689
8689
|
targetStakeAccount
|
|
8690
8690
|
);
|
|
8691
8691
|
} else {
|
|
8692
|
-
const account =
|
|
8692
|
+
const account = txBlock.createStakeAccount(stakeMarketCoinName);
|
|
8693
8693
|
await txBlock.stakeQuick(marketCoin, stakeMarketCoinName, account);
|
|
8694
8694
|
txBlock.transferObjects([account], sender);
|
|
8695
8695
|
}
|
|
@@ -8786,12 +8786,8 @@ var ScallopClient = class {
|
|
|
8786
8786
|
const txBlock = this.builder.createTxBlock();
|
|
8787
8787
|
const sender = walletAddress ?? this.walletAddress;
|
|
8788
8788
|
txBlock.setSender(sender);
|
|
8789
|
-
const [coin, loan] =
|
|
8790
|
-
|
|
8791
|
-
await callback(txBlock, coin),
|
|
8792
|
-
loan,
|
|
8793
|
-
poolCoinName
|
|
8794
|
-
);
|
|
8789
|
+
const [coin, loan] = txBlock.borrowFlashLoan(amount, poolCoinName);
|
|
8790
|
+
txBlock.repayFlashLoan(await callback(txBlock, coin), loan, poolCoinName);
|
|
8795
8791
|
if (sign) {
|
|
8796
8792
|
return await this.suiKit.signAndSendTxn(
|
|
8797
8793
|
txBlock
|
|
@@ -8804,7 +8800,7 @@ var ScallopClient = class {
|
|
|
8804
8800
|
const txBlock = this.builder.createTxBlock();
|
|
8805
8801
|
const sender = walletAddress ?? this.walletAddress;
|
|
8806
8802
|
txBlock.setSender(sender);
|
|
8807
|
-
const stakeAccount =
|
|
8803
|
+
const stakeAccount = txBlock.createStakeAccount(marketCoinName);
|
|
8808
8804
|
txBlock.transferObjects([stakeAccount], sender);
|
|
8809
8805
|
if (sign) {
|
|
8810
8806
|
return await this.suiKit.signAndSendTxn(
|
|
@@ -8823,7 +8819,7 @@ var ScallopClient = class {
|
|
|
8823
8819
|
if (targetStakeAccount) {
|
|
8824
8820
|
await txBlock.stakeQuick(amount, stakeMarketCoinName, targetStakeAccount);
|
|
8825
8821
|
} else {
|
|
8826
|
-
const account =
|
|
8822
|
+
const account = txBlock.createStakeAccount(stakeMarketCoinName);
|
|
8827
8823
|
await txBlock.stakeQuick(amount, stakeMarketCoinName, account);
|
|
8828
8824
|
txBlock.transferObjects([account], sender);
|
|
8829
8825
|
}
|
|
@@ -8873,7 +8869,7 @@ var ScallopClient = class {
|
|
|
8873
8869
|
);
|
|
8874
8870
|
const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
|
|
8875
8871
|
if (stakeMarketCoin) {
|
|
8876
|
-
const coin =
|
|
8872
|
+
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
8877
8873
|
await this.utils.mergeSimilarCoins(
|
|
8878
8874
|
txBlock,
|
|
8879
8875
|
coin,
|
|
@@ -9034,7 +9030,7 @@ var ScallopClient = class {
|
|
|
9034
9030
|
throw e;
|
|
9035
9031
|
}
|
|
9036
9032
|
if (toDestroyMarketCoin) {
|
|
9037
|
-
const sCoin =
|
|
9033
|
+
const sCoin = txBlock.mintSCoin(
|
|
9038
9034
|
sCoinName,
|
|
9039
9035
|
toDestroyMarketCoin
|
|
9040
9036
|
);
|