@scallop-io/sui-scallop-sdk 0.47.1 → 0.47.2

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 CHANGED
@@ -3495,7 +3495,7 @@ var getBindedObligationId = async ({
3495
3495
  };
3496
3496
  var getBindedVeScaKey = async ({
3497
3497
  address
3498
- }, obliationId) => {
3498
+ }, obligationId) => {
3499
3499
  const borrowIncentiveObjectId = address.get("borrowIncentive.object");
3500
3500
  const incentiveAccountsId = address.get("borrowIncentive.incentiveAccounts");
3501
3501
  const corePkg = address.get("core.object");
@@ -3512,7 +3512,7 @@ var getBindedVeScaKey = async ({
3512
3512
  parentId: incentiveAccountsTableId,
3513
3513
  name: {
3514
3514
  type: `${borrowIncentiveObjectId}::typed_id::TypedID<${corePkg}::obligation::Obligation>`,
3515
- value: obliationId
3515
+ value: obligationId
3516
3516
  }
3517
3517
  });
3518
3518
  if (bindedIncentiveAcc?.data?.content?.dataType !== "moveObject")
@@ -5559,11 +5559,241 @@ var newSpoolTxBlock = (builder, initTxBlock) => {
5559
5559
 
5560
5560
  // src/builders/borrowIncentiveBuilder.ts
5561
5561
  var import_transactions3 = require("@mysten/sui.js/transactions");
5562
- var import_utils18 = require("@mysten/sui.js/utils");
5563
- var import_sui_kit8 = require("@scallop-io/sui-kit");
5562
+ var import_utils17 = require("@mysten/sui.js/utils");
5563
+ var import_sui_kit7 = require("@scallop-io/sui-kit");
5564
+ var requireObligationInfo2 = async (...params) => {
5565
+ const [builder, txBlock, obligationId, obligationKey] = params;
5566
+ if (params.length === 4 && obligationId && obligationKey && typeof obligationId === "string") {
5567
+ const obligationLocked = await getObligationLocked(
5568
+ builder.cache,
5569
+ obligationId
5570
+ );
5571
+ return { obligationId, obligationKey, obligationLocked };
5572
+ }
5573
+ const sender = requireSender(txBlock);
5574
+ const obligations = await getObligations(builder, sender);
5575
+ if (obligations.length === 0) {
5576
+ throw new Error(`No obligation found for sender ${sender}`);
5577
+ }
5578
+ const selectedObligation = obligations.find(
5579
+ (obligation) => obligation.id === obligationId || obligation.keyId === obligationKey
5580
+ ) ?? obligations[0];
5581
+ return {
5582
+ obligationId: selectedObligation.id,
5583
+ obligationKey: selectedObligation.keyId,
5584
+ obligationLocked: selectedObligation.locked
5585
+ };
5586
+ };
5587
+ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
5588
+ const borrowIncentiveIds = {
5589
+ borrowIncentivePkg: builder.address.get("borrowIncentive.id"),
5590
+ query: builder.address.get("borrowIncentive.query"),
5591
+ config: builder.address.get("borrowIncentive.config"),
5592
+ incentivePools: builder.address.get("borrowIncentive.incentivePools"),
5593
+ incentiveAccounts: builder.address.get(
5594
+ "borrowIncentive.incentiveAccounts"
5595
+ ),
5596
+ obligationAccessStore: builder.address.get("core.obligationAccessStore")
5597
+ };
5598
+ const veScaIds = {
5599
+ table: builder.address.get("vesca.table"),
5600
+ treasury: builder.address.get("vesca.treasury"),
5601
+ config: builder.address.get("vesca.config")
5602
+ };
5603
+ return {
5604
+ stakeObligation: (obligationId, obligationKey) => {
5605
+ txBlock.moveCall(
5606
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::stake`,
5607
+ [
5608
+ borrowIncentiveIds.config,
5609
+ borrowIncentiveIds.incentivePools,
5610
+ borrowIncentiveIds.incentiveAccounts,
5611
+ obligationKey,
5612
+ obligationId,
5613
+ borrowIncentiveIds.obligationAccessStore,
5614
+ import_utils17.SUI_CLOCK_OBJECT_ID
5615
+ ]
5616
+ );
5617
+ },
5618
+ stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
5619
+ txBlock.moveCall(
5620
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca`,
5621
+ [
5622
+ borrowIncentiveIds.config,
5623
+ borrowIncentiveIds.incentivePools,
5624
+ borrowIncentiveIds.incentiveAccounts,
5625
+ obligationKey,
5626
+ obligationId,
5627
+ borrowIncentiveIds.obligationAccessStore,
5628
+ veScaIds.config,
5629
+ veScaIds.treasury,
5630
+ veScaIds.table,
5631
+ veScaKey,
5632
+ import_utils17.SUI_CLOCK_OBJECT_ID
5633
+ ],
5634
+ []
5635
+ );
5636
+ },
5637
+ unstakeObligation: (obligationId, obligationKey) => {
5638
+ txBlock.moveCall(
5639
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
5640
+ [
5641
+ borrowIncentiveIds.config,
5642
+ borrowIncentiveIds.incentivePools,
5643
+ borrowIncentiveIds.incentiveAccounts,
5644
+ obligationKey,
5645
+ obligationId,
5646
+ import_utils17.SUI_CLOCK_OBJECT_ID
5647
+ ]
5648
+ );
5649
+ },
5650
+ claimBorrowIncentive: (obligationId, obligationKey, coinName, rewardCoinName) => {
5651
+ const rewardCoinNames = builder.utils.getBorrowIncentiveRewardCoinName(coinName);
5652
+ if (rewardCoinNames.includes(rewardCoinName) === false) {
5653
+ throw new Error(`Invalid reward coin name ${rewardCoinName}`);
5654
+ }
5655
+ const rewardType = builder.utils.parseCoinType(rewardCoinName);
5656
+ return txBlock.moveCall(
5657
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::redeem_rewards`,
5658
+ [
5659
+ borrowIncentiveIds.config,
5660
+ borrowIncentiveIds.incentivePools,
5661
+ borrowIncentiveIds.incentiveAccounts,
5662
+ obligationKey,
5663
+ obligationId,
5664
+ import_utils17.SUI_CLOCK_OBJECT_ID
5665
+ ],
5666
+ [rewardType]
5667
+ );
5668
+ },
5669
+ deactivateBoost: (obligation, veScaKey) => {
5670
+ return txBlock.moveCall(
5671
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
5672
+ [
5673
+ borrowIncentiveIds.config,
5674
+ borrowIncentiveIds.incentivePools,
5675
+ borrowIncentiveIds.incentiveAccounts,
5676
+ obligation,
5677
+ veScaKey,
5678
+ import_utils17.SUI_CLOCK_OBJECT_ID
5679
+ ]
5680
+ );
5681
+ }
5682
+ };
5683
+ };
5684
+ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
5685
+ return {
5686
+ stakeObligationQuick: async (obligation, obligationKey) => {
5687
+ const {
5688
+ obligationId: obligationArg,
5689
+ obligationKey: obligationKeyArg,
5690
+ obligationLocked
5691
+ } = await requireObligationInfo2(
5692
+ builder,
5693
+ txBlock,
5694
+ obligation,
5695
+ obligationKey
5696
+ );
5697
+ const unstakeObligationBeforeStake = !!txBlock.txBlock.blockData.transactions.find(
5698
+ (txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
5699
+ );
5700
+ if (!obligationLocked || unstakeObligationBeforeStake) {
5701
+ txBlock.stakeObligation(obligationArg, obligationKeyArg);
5702
+ }
5703
+ },
5704
+ stakeObligationWithVeScaQuick: async (obligation, obligationKey, veScaKey) => {
5705
+ const {
5706
+ obligationId: obligationArg,
5707
+ obligationKey: obligationKeyArg,
5708
+ obligationLocked
5709
+ } = await requireObligationInfo2(
5710
+ builder,
5711
+ txBlock,
5712
+ obligation,
5713
+ obligationKey
5714
+ );
5715
+ const unstakeObligationBeforeStake = !!txBlock.txBlock.blockData.transactions.find(
5716
+ (txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
5717
+ );
5718
+ if (!obligationLocked || unstakeObligationBeforeStake) {
5719
+ const bindedVeScaKey = await builder.query.getBindedVeScaKey(obligationArg);
5720
+ if (veScaKey && veScaKey !== bindedVeScaKey) {
5721
+ throw new Error(
5722
+ "Binded veScaKey is not equal to the provided veScaKey"
5723
+ );
5724
+ }
5725
+ if (bindedVeScaKey) {
5726
+ txBlock.stakeObligationWithVesca(
5727
+ obligationArg,
5728
+ obligationKeyArg,
5729
+ bindedVeScaKey
5730
+ );
5731
+ } else {
5732
+ txBlock.stakeObligation(obligationArg, obligationKeyArg);
5733
+ }
5734
+ }
5735
+ },
5736
+ unstakeObligationQuick: async (obligation, obligationKey) => {
5737
+ const {
5738
+ obligationId: obligationArg,
5739
+ obligationKey: obligationKeyArg,
5740
+ obligationLocked
5741
+ } = await requireObligationInfo2(
5742
+ builder,
5743
+ txBlock,
5744
+ obligation,
5745
+ obligationKey
5746
+ );
5747
+ if (obligationLocked) {
5748
+ txBlock.unstakeObligation(obligationArg, obligationKeyArg);
5749
+ }
5750
+ },
5751
+ claimBorrowIncentiveQuick: async (coinName, rewardCoinName, obligation, obligationKey) => {
5752
+ const { obligationId: obligationArg, obligationKey: obligationKeyArg } = await requireObligationInfo2(
5753
+ builder,
5754
+ txBlock,
5755
+ obligation,
5756
+ obligationKey
5757
+ );
5758
+ return txBlock.claimBorrowIncentive(
5759
+ obligationArg,
5760
+ obligationKeyArg,
5761
+ coinName,
5762
+ rewardCoinName
5763
+ );
5764
+ }
5765
+ };
5766
+ };
5767
+ var newBorrowIncentiveTxBlock = (builder, initTxBlock) => {
5768
+ const txBlock = initTxBlock instanceof import_transactions3.TransactionBlock ? new import_sui_kit7.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit7.SuiTxBlock();
5769
+ const normalMethod = generateBorrowIncentiveNormalMethod({
5770
+ builder,
5771
+ txBlock
5772
+ });
5773
+ const normalTxBlock = new Proxy(txBlock, {
5774
+ get: (target, prop) => {
5775
+ if (prop in normalMethod) {
5776
+ return Reflect.get(normalMethod, prop);
5777
+ }
5778
+ return Reflect.get(target, prop);
5779
+ }
5780
+ });
5781
+ const quickMethod = generateBorrowIncentiveQuickMethod({
5782
+ builder,
5783
+ txBlock: normalTxBlock
5784
+ });
5785
+ return new Proxy(normalTxBlock, {
5786
+ get: (target, prop) => {
5787
+ if (prop in quickMethod) {
5788
+ return Reflect.get(quickMethod, prop);
5789
+ }
5790
+ return Reflect.get(target, prop);
5791
+ }
5792
+ });
5793
+ };
5564
5794
 
5565
5795
  // src/builders/vescaBuilder.ts
5566
- var import_sui_kit7 = require("@scallop-io/sui-kit");
5796
+ var import_sui_kit8 = require("@scallop-io/sui-kit");
5567
5797
  var requireVeSca = async (...params) => {
5568
5798
  const [builder, txBlock, veScaKey] = params;
5569
5799
  if (params.length === 3 && veScaKey && typeof veScaKey === "string") {
@@ -5578,7 +5808,7 @@ var requireVeSca = async (...params) => {
5578
5808
  if (veScas.length === 0) {
5579
5809
  return void 0;
5580
5810
  }
5581
- return veScas[0];
5811
+ return veScaKey ? veScas.find(({ keyId }) => veScaKey === keyId) : veScas[0];
5582
5812
  };
5583
5813
  var generateNormalVeScaMethod = ({
5584
5814
  builder,
@@ -5600,7 +5830,7 @@ var generateNormalVeScaMethod = ({
5600
5830
  veScaIds.treasury,
5601
5831
  scaCoin,
5602
5832
  unlockAtInSecondTimestamp,
5603
- import_sui_kit7.SUI_CLOCK_OBJECT_ID
5833
+ import_sui_kit8.SUI_CLOCK_OBJECT_ID
5604
5834
  ],
5605
5835
  []
5606
5836
  );
@@ -5614,7 +5844,7 @@ var generateNormalVeScaMethod = ({
5614
5844
  veScaIds.table,
5615
5845
  veScaIds.treasury,
5616
5846
  newUnlockAtInSecondTimestamp,
5617
- import_sui_kit7.SUI_CLOCK_OBJECT_ID
5847
+ import_sui_kit8.SUI_CLOCK_OBJECT_ID
5618
5848
  ],
5619
5849
  []
5620
5850
  );
@@ -5628,7 +5858,7 @@ var generateNormalVeScaMethod = ({
5628
5858
  veScaIds.table,
5629
5859
  veScaIds.treasury,
5630
5860
  scaCoin,
5631
- import_sui_kit7.SUI_CLOCK_OBJECT_ID
5861
+ import_sui_kit8.SUI_CLOCK_OBJECT_ID
5632
5862
  ],
5633
5863
  []
5634
5864
  );
@@ -5643,7 +5873,7 @@ var generateNormalVeScaMethod = ({
5643
5873
  veScaIds.treasury,
5644
5874
  scaCoin,
5645
5875
  newUnlockAtInSecondTimestamp,
5646
- import_sui_kit7.SUI_CLOCK_OBJECT_ID
5876
+ import_sui_kit8.SUI_CLOCK_OBJECT_ID
5647
5877
  ],
5648
5878
  []
5649
5879
  );
@@ -5656,7 +5886,7 @@ var generateNormalVeScaMethod = ({
5656
5886
  veScaKey,
5657
5887
  veScaIds.table,
5658
5888
  veScaIds.treasury,
5659
- import_sui_kit7.SUI_CLOCK_OBJECT_ID
5889
+ import_sui_kit8.SUI_CLOCK_OBJECT_ID
5660
5890
  ],
5661
5891
  []
5662
5892
  );
@@ -5811,7 +6041,7 @@ var generateQuickVeScaMethod = ({
5811
6041
  };
5812
6042
  };
5813
6043
  var newVeScaTxBlock = (builder, initTxBlock) => {
5814
- const txBlock = initTxBlock instanceof import_sui_kit7.TransactionBlock ? new import_sui_kit7.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit7.SuiTxBlock();
6044
+ const txBlock = initTxBlock instanceof import_sui_kit8.TransactionBlock ? new import_sui_kit8.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit8.SuiTxBlock();
5815
6045
  const normalMethod = generateNormalVeScaMethod({
5816
6046
  builder,
5817
6047
  txBlock
@@ -5838,241 +6068,6 @@ var newVeScaTxBlock = (builder, initTxBlock) => {
5838
6068
  });
5839
6069
  };
5840
6070
 
5841
- // src/builders/borrowIncentiveBuilder.ts
5842
- var requireObligationInfo2 = async (...params) => {
5843
- const [builder, txBlock, obligationId, obligationKey] = params;
5844
- if (params.length === 4 && obligationId && obligationKey && typeof obligationId === "string") {
5845
- const obligationLocked = await getObligationLocked(
5846
- builder.cache,
5847
- obligationId
5848
- );
5849
- return { obligationId, obligationKey, obligationLocked };
5850
- }
5851
- const sender = requireSender(txBlock);
5852
- const obligations = await getObligations(builder, sender);
5853
- if (obligations.length === 0) {
5854
- throw new Error(`No obligation found for sender ${sender}`);
5855
- }
5856
- const selectedObligation = obligations.find(
5857
- (obligation) => obligation.id === obligationId || obligation.keyId === obligationKey
5858
- ) ?? obligations[0];
5859
- return {
5860
- obligationId: selectedObligation.id,
5861
- obligationKey: selectedObligation.keyId,
5862
- obligationLocked: selectedObligation.locked
5863
- };
5864
- };
5865
- var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
5866
- const borrowIncentiveIds = {
5867
- borrowIncentivePkg: builder.address.get("borrowIncentive.id"),
5868
- query: builder.address.get("borrowIncentive.query"),
5869
- config: builder.address.get("borrowIncentive.config"),
5870
- incentivePools: builder.address.get("borrowIncentive.incentivePools"),
5871
- incentiveAccounts: builder.address.get(
5872
- "borrowIncentive.incentiveAccounts"
5873
- ),
5874
- obligationAccessStore: builder.address.get("core.obligationAccessStore")
5875
- };
5876
- const veScaIds = {
5877
- table: builder.address.get("vesca.table"),
5878
- treasury: builder.address.get("vesca.treasury"),
5879
- config: builder.address.get("vesca.config")
5880
- };
5881
- return {
5882
- stakeObligation: (obligationId, obligationKey) => {
5883
- txBlock.moveCall(
5884
- `${borrowIncentiveIds.borrowIncentivePkg}::user::stake`,
5885
- [
5886
- borrowIncentiveIds.config,
5887
- borrowIncentiveIds.incentivePools,
5888
- borrowIncentiveIds.incentiveAccounts,
5889
- obligationKey,
5890
- obligationId,
5891
- borrowIncentiveIds.obligationAccessStore,
5892
- import_utils18.SUI_CLOCK_OBJECT_ID
5893
- ]
5894
- );
5895
- },
5896
- stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
5897
- txBlock.moveCall(
5898
- `${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca`,
5899
- [
5900
- borrowIncentiveIds.config,
5901
- borrowIncentiveIds.incentivePools,
5902
- borrowIncentiveIds.incentiveAccounts,
5903
- obligationKey,
5904
- obligationId,
5905
- borrowIncentiveIds.obligationAccessStore,
5906
- veScaIds.config,
5907
- veScaIds.treasury,
5908
- veScaIds.table,
5909
- veScaKey,
5910
- import_utils18.SUI_CLOCK_OBJECT_ID
5911
- ],
5912
- []
5913
- );
5914
- },
5915
- unstakeObligation: (obligationId, obligationKey) => {
5916
- txBlock.moveCall(
5917
- `${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
5918
- [
5919
- borrowIncentiveIds.config,
5920
- borrowIncentiveIds.incentivePools,
5921
- borrowIncentiveIds.incentiveAccounts,
5922
- obligationKey,
5923
- obligationId,
5924
- import_utils18.SUI_CLOCK_OBJECT_ID
5925
- ]
5926
- );
5927
- },
5928
- claimBorrowIncentive: (obligationId, obligationKey, coinName, rewardCoinName) => {
5929
- const rewardCoinNames = builder.utils.getBorrowIncentiveRewardCoinName(coinName);
5930
- if (rewardCoinNames.includes(rewardCoinName) === false) {
5931
- throw new Error(`Invalid reward coin name ${rewardCoinName}`);
5932
- }
5933
- const rewardType = builder.utils.parseCoinType(rewardCoinName);
5934
- return txBlock.moveCall(
5935
- `${borrowIncentiveIds.borrowIncentivePkg}::user::redeem_rewards`,
5936
- [
5937
- borrowIncentiveIds.config,
5938
- borrowIncentiveIds.incentivePools,
5939
- borrowIncentiveIds.incentiveAccounts,
5940
- obligationKey,
5941
- obligationId,
5942
- import_utils18.SUI_CLOCK_OBJECT_ID
5943
- ],
5944
- [rewardType]
5945
- );
5946
- },
5947
- deactivateBoost: (obligation, veScaKey) => {
5948
- return txBlock.moveCall(
5949
- `${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
5950
- [
5951
- borrowIncentiveIds.config,
5952
- borrowIncentiveIds.incentivePools,
5953
- borrowIncentiveIds.incentiveAccounts,
5954
- obligation,
5955
- veScaKey,
5956
- import_utils18.SUI_CLOCK_OBJECT_ID
5957
- ]
5958
- );
5959
- }
5960
- };
5961
- };
5962
- var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
5963
- return {
5964
- stakeObligationQuick: async (obligation, obligationKey) => {
5965
- const {
5966
- obligationId: obligationArg,
5967
- obligationKey: obligationKeyArg,
5968
- obligationLocked
5969
- } = await requireObligationInfo2(
5970
- builder,
5971
- txBlock,
5972
- obligation,
5973
- obligationKey
5974
- );
5975
- const unstakeObligationBeforeStake = !!txBlock.txBlock.blockData.transactions.find(
5976
- (txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
5977
- );
5978
- if (!obligationLocked || unstakeObligationBeforeStake) {
5979
- txBlock.stakeObligation(obligationArg, obligationKeyArg);
5980
- }
5981
- },
5982
- stakeObligationWithVeScaQuick: async (obligation, obligationKey, veScaKey) => {
5983
- const {
5984
- obligationId: obligationArg,
5985
- obligationKey: obligationKeyArg,
5986
- obligationLocked
5987
- } = await requireObligationInfo2(
5988
- builder,
5989
- txBlock,
5990
- obligation,
5991
- obligationKey
5992
- );
5993
- const unstakeObligationBeforeStake = !!txBlock.txBlock.blockData.transactions.find(
5994
- (txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
5995
- );
5996
- if (!obligationLocked || unstakeObligationBeforeStake) {
5997
- const veSca = await requireVeSca(builder, txBlock, veScaKey);
5998
- if (veSca) {
5999
- const bindedObligationId = await getBindedObligationId(
6000
- builder,
6001
- veSca.keyId
6002
- );
6003
- if ((!bindedObligationId || bindedObligationId === obligationArg) && veSca.currentVeScaBalance > 0) {
6004
- txBlock.stakeObligationWithVesca(
6005
- obligationArg,
6006
- obligationKeyArg,
6007
- veSca.keyId
6008
- );
6009
- } else {
6010
- txBlock.stakeObligation(obligationArg, obligationKeyArg);
6011
- }
6012
- } else {
6013
- txBlock.stakeObligation(obligationArg, obligationKeyArg);
6014
- }
6015
- }
6016
- },
6017
- unstakeObligationQuick: async (obligation, obligationKey) => {
6018
- const {
6019
- obligationId: obligationArg,
6020
- obligationKey: obligationKeyArg,
6021
- obligationLocked
6022
- } = await requireObligationInfo2(
6023
- builder,
6024
- txBlock,
6025
- obligation,
6026
- obligationKey
6027
- );
6028
- if (obligationLocked) {
6029
- txBlock.unstakeObligation(obligationArg, obligationKeyArg);
6030
- }
6031
- },
6032
- claimBorrowIncentiveQuick: async (coinName, rewardCoinName, obligation, obligationKey) => {
6033
- const { obligationId: obligationArg, obligationKey: obligationKeyArg } = await requireObligationInfo2(
6034
- builder,
6035
- txBlock,
6036
- obligation,
6037
- obligationKey
6038
- );
6039
- return txBlock.claimBorrowIncentive(
6040
- obligationArg,
6041
- obligationKeyArg,
6042
- coinName,
6043
- rewardCoinName
6044
- );
6045
- }
6046
- };
6047
- };
6048
- var newBorrowIncentiveTxBlock = (builder, initTxBlock) => {
6049
- const txBlock = initTxBlock instanceof import_transactions3.TransactionBlock ? new import_sui_kit8.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit8.SuiTxBlock();
6050
- const normalMethod = generateBorrowIncentiveNormalMethod({
6051
- builder,
6052
- txBlock
6053
- });
6054
- const normalTxBlock = new Proxy(txBlock, {
6055
- get: (target, prop) => {
6056
- if (prop in normalMethod) {
6057
- return Reflect.get(normalMethod, prop);
6058
- }
6059
- return Reflect.get(target, prop);
6060
- }
6061
- });
6062
- const quickMethod = generateBorrowIncentiveQuickMethod({
6063
- builder,
6064
- txBlock: normalTxBlock
6065
- });
6066
- return new Proxy(normalTxBlock, {
6067
- get: (target, prop) => {
6068
- if (prop in quickMethod) {
6069
- return Reflect.get(quickMethod, prop);
6070
- }
6071
- return Reflect.get(target, prop);
6072
- }
6073
- });
6074
- };
6075
-
6076
6071
  // src/builders/referralBuilder.ts
6077
6072
  var import_sui_kit9 = require("@scallop-io/sui-kit");
6078
6073
  var generateReferralNormalMethod = ({