@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.mjs CHANGED
@@ -3421,7 +3421,7 @@ var getBindedObligationId = async ({
3421
3421
  };
3422
3422
  var getBindedVeScaKey = async ({
3423
3423
  address
3424
- }, obliationId) => {
3424
+ }, obligationId) => {
3425
3425
  const borrowIncentiveObjectId = address.get("borrowIncentive.object");
3426
3426
  const incentiveAccountsId = address.get("borrowIncentive.incentiveAccounts");
3427
3427
  const corePkg = address.get("core.object");
@@ -3438,7 +3438,7 @@ var getBindedVeScaKey = async ({
3438
3438
  parentId: incentiveAccountsTableId,
3439
3439
  name: {
3440
3440
  type: `${borrowIncentiveObjectId}::typed_id::TypedID<${corePkg}::obligation::Obligation>`,
3441
- value: obliationId
3441
+ value: obligationId
3442
3442
  }
3443
3443
  });
3444
3444
  if (bindedIncentiveAcc?.data?.content?.dataType !== "moveObject")
@@ -5487,15 +5487,245 @@ var newSpoolTxBlock = (builder, initTxBlock) => {
5487
5487
  };
5488
5488
 
5489
5489
  // src/builders/borrowIncentiveBuilder.ts
5490
- import { TransactionBlock as TransactionBlock4 } from "@mysten/sui.js/transactions";
5491
- import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID6 } from "@mysten/sui.js/utils";
5492
- import { SuiTxBlock as SuiKitTxBlock4 } from "@scallop-io/sui-kit";
5490
+ import { TransactionBlock as TransactionBlock3 } from "@mysten/sui.js/transactions";
5491
+ import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID5 } from "@mysten/sui.js/utils";
5492
+ import { SuiTxBlock as SuiKitTxBlock3 } from "@scallop-io/sui-kit";
5493
+ var requireObligationInfo2 = async (...params) => {
5494
+ const [builder, txBlock, obligationId, obligationKey] = params;
5495
+ if (params.length === 4 && obligationId && obligationKey && typeof obligationId === "string") {
5496
+ const obligationLocked = await getObligationLocked(
5497
+ builder.cache,
5498
+ obligationId
5499
+ );
5500
+ return { obligationId, obligationKey, obligationLocked };
5501
+ }
5502
+ const sender = requireSender(txBlock);
5503
+ const obligations = await getObligations(builder, sender);
5504
+ if (obligations.length === 0) {
5505
+ throw new Error(`No obligation found for sender ${sender}`);
5506
+ }
5507
+ const selectedObligation = obligations.find(
5508
+ (obligation) => obligation.id === obligationId || obligation.keyId === obligationKey
5509
+ ) ?? obligations[0];
5510
+ return {
5511
+ obligationId: selectedObligation.id,
5512
+ obligationKey: selectedObligation.keyId,
5513
+ obligationLocked: selectedObligation.locked
5514
+ };
5515
+ };
5516
+ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
5517
+ const borrowIncentiveIds = {
5518
+ borrowIncentivePkg: builder.address.get("borrowIncentive.id"),
5519
+ query: builder.address.get("borrowIncentive.query"),
5520
+ config: builder.address.get("borrowIncentive.config"),
5521
+ incentivePools: builder.address.get("borrowIncentive.incentivePools"),
5522
+ incentiveAccounts: builder.address.get(
5523
+ "borrowIncentive.incentiveAccounts"
5524
+ ),
5525
+ obligationAccessStore: builder.address.get("core.obligationAccessStore")
5526
+ };
5527
+ const veScaIds = {
5528
+ table: builder.address.get("vesca.table"),
5529
+ treasury: builder.address.get("vesca.treasury"),
5530
+ config: builder.address.get("vesca.config")
5531
+ };
5532
+ return {
5533
+ stakeObligation: (obligationId, obligationKey) => {
5534
+ txBlock.moveCall(
5535
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::stake`,
5536
+ [
5537
+ borrowIncentiveIds.config,
5538
+ borrowIncentiveIds.incentivePools,
5539
+ borrowIncentiveIds.incentiveAccounts,
5540
+ obligationKey,
5541
+ obligationId,
5542
+ borrowIncentiveIds.obligationAccessStore,
5543
+ SUI_CLOCK_OBJECT_ID5
5544
+ ]
5545
+ );
5546
+ },
5547
+ stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
5548
+ txBlock.moveCall(
5549
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca`,
5550
+ [
5551
+ borrowIncentiveIds.config,
5552
+ borrowIncentiveIds.incentivePools,
5553
+ borrowIncentiveIds.incentiveAccounts,
5554
+ obligationKey,
5555
+ obligationId,
5556
+ borrowIncentiveIds.obligationAccessStore,
5557
+ veScaIds.config,
5558
+ veScaIds.treasury,
5559
+ veScaIds.table,
5560
+ veScaKey,
5561
+ SUI_CLOCK_OBJECT_ID5
5562
+ ],
5563
+ []
5564
+ );
5565
+ },
5566
+ unstakeObligation: (obligationId, obligationKey) => {
5567
+ txBlock.moveCall(
5568
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
5569
+ [
5570
+ borrowIncentiveIds.config,
5571
+ borrowIncentiveIds.incentivePools,
5572
+ borrowIncentiveIds.incentiveAccounts,
5573
+ obligationKey,
5574
+ obligationId,
5575
+ SUI_CLOCK_OBJECT_ID5
5576
+ ]
5577
+ );
5578
+ },
5579
+ claimBorrowIncentive: (obligationId, obligationKey, coinName, rewardCoinName) => {
5580
+ const rewardCoinNames = builder.utils.getBorrowIncentiveRewardCoinName(coinName);
5581
+ if (rewardCoinNames.includes(rewardCoinName) === false) {
5582
+ throw new Error(`Invalid reward coin name ${rewardCoinName}`);
5583
+ }
5584
+ const rewardType = builder.utils.parseCoinType(rewardCoinName);
5585
+ return txBlock.moveCall(
5586
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::redeem_rewards`,
5587
+ [
5588
+ borrowIncentiveIds.config,
5589
+ borrowIncentiveIds.incentivePools,
5590
+ borrowIncentiveIds.incentiveAccounts,
5591
+ obligationKey,
5592
+ obligationId,
5593
+ SUI_CLOCK_OBJECT_ID5
5594
+ ],
5595
+ [rewardType]
5596
+ );
5597
+ },
5598
+ deactivateBoost: (obligation, veScaKey) => {
5599
+ return txBlock.moveCall(
5600
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
5601
+ [
5602
+ borrowIncentiveIds.config,
5603
+ borrowIncentiveIds.incentivePools,
5604
+ borrowIncentiveIds.incentiveAccounts,
5605
+ obligation,
5606
+ veScaKey,
5607
+ SUI_CLOCK_OBJECT_ID5
5608
+ ]
5609
+ );
5610
+ }
5611
+ };
5612
+ };
5613
+ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
5614
+ return {
5615
+ stakeObligationQuick: async (obligation, obligationKey) => {
5616
+ const {
5617
+ obligationId: obligationArg,
5618
+ obligationKey: obligationKeyArg,
5619
+ obligationLocked
5620
+ } = await requireObligationInfo2(
5621
+ builder,
5622
+ txBlock,
5623
+ obligation,
5624
+ obligationKey
5625
+ );
5626
+ const unstakeObligationBeforeStake = !!txBlock.txBlock.blockData.transactions.find(
5627
+ (txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
5628
+ );
5629
+ if (!obligationLocked || unstakeObligationBeforeStake) {
5630
+ txBlock.stakeObligation(obligationArg, obligationKeyArg);
5631
+ }
5632
+ },
5633
+ stakeObligationWithVeScaQuick: async (obligation, obligationKey, veScaKey) => {
5634
+ const {
5635
+ obligationId: obligationArg,
5636
+ obligationKey: obligationKeyArg,
5637
+ obligationLocked
5638
+ } = await requireObligationInfo2(
5639
+ builder,
5640
+ txBlock,
5641
+ obligation,
5642
+ obligationKey
5643
+ );
5644
+ const unstakeObligationBeforeStake = !!txBlock.txBlock.blockData.transactions.find(
5645
+ (txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
5646
+ );
5647
+ if (!obligationLocked || unstakeObligationBeforeStake) {
5648
+ const bindedVeScaKey = await builder.query.getBindedVeScaKey(obligationArg);
5649
+ if (veScaKey && veScaKey !== bindedVeScaKey) {
5650
+ throw new Error(
5651
+ "Binded veScaKey is not equal to the provided veScaKey"
5652
+ );
5653
+ }
5654
+ if (bindedVeScaKey) {
5655
+ txBlock.stakeObligationWithVesca(
5656
+ obligationArg,
5657
+ obligationKeyArg,
5658
+ bindedVeScaKey
5659
+ );
5660
+ } else {
5661
+ txBlock.stakeObligation(obligationArg, obligationKeyArg);
5662
+ }
5663
+ }
5664
+ },
5665
+ unstakeObligationQuick: async (obligation, obligationKey) => {
5666
+ const {
5667
+ obligationId: obligationArg,
5668
+ obligationKey: obligationKeyArg,
5669
+ obligationLocked
5670
+ } = await requireObligationInfo2(
5671
+ builder,
5672
+ txBlock,
5673
+ obligation,
5674
+ obligationKey
5675
+ );
5676
+ if (obligationLocked) {
5677
+ txBlock.unstakeObligation(obligationArg, obligationKeyArg);
5678
+ }
5679
+ },
5680
+ claimBorrowIncentiveQuick: async (coinName, rewardCoinName, obligation, obligationKey) => {
5681
+ const { obligationId: obligationArg, obligationKey: obligationKeyArg } = await requireObligationInfo2(
5682
+ builder,
5683
+ txBlock,
5684
+ obligation,
5685
+ obligationKey
5686
+ );
5687
+ return txBlock.claimBorrowIncentive(
5688
+ obligationArg,
5689
+ obligationKeyArg,
5690
+ coinName,
5691
+ rewardCoinName
5692
+ );
5693
+ }
5694
+ };
5695
+ };
5696
+ var newBorrowIncentiveTxBlock = (builder, initTxBlock) => {
5697
+ const txBlock = initTxBlock instanceof TransactionBlock3 ? new SuiKitTxBlock3(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock3();
5698
+ const normalMethod = generateBorrowIncentiveNormalMethod({
5699
+ builder,
5700
+ txBlock
5701
+ });
5702
+ const normalTxBlock = new Proxy(txBlock, {
5703
+ get: (target, prop) => {
5704
+ if (prop in normalMethod) {
5705
+ return Reflect.get(normalMethod, prop);
5706
+ }
5707
+ return Reflect.get(target, prop);
5708
+ }
5709
+ });
5710
+ const quickMethod = generateBorrowIncentiveQuickMethod({
5711
+ builder,
5712
+ txBlock: normalTxBlock
5713
+ });
5714
+ return new Proxy(normalTxBlock, {
5715
+ get: (target, prop) => {
5716
+ if (prop in quickMethod) {
5717
+ return Reflect.get(quickMethod, prop);
5718
+ }
5719
+ return Reflect.get(target, prop);
5720
+ }
5721
+ });
5722
+ };
5493
5723
 
5494
5724
  // src/builders/vescaBuilder.ts
5495
5725
  import {
5496
- SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID5,
5497
- TransactionBlock as TransactionBlock3,
5498
- SuiTxBlock as SuiKitTxBlock3
5726
+ SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID6,
5727
+ TransactionBlock as TransactionBlock4,
5728
+ SuiTxBlock as SuiKitTxBlock4
5499
5729
  } from "@scallop-io/sui-kit";
5500
5730
  var requireVeSca = async (...params) => {
5501
5731
  const [builder, txBlock, veScaKey] = params;
@@ -5511,7 +5741,7 @@ var requireVeSca = async (...params) => {
5511
5741
  if (veScas.length === 0) {
5512
5742
  return void 0;
5513
5743
  }
5514
- return veScas[0];
5744
+ return veScaKey ? veScas.find(({ keyId }) => veScaKey === keyId) : veScas[0];
5515
5745
  };
5516
5746
  var generateNormalVeScaMethod = ({
5517
5747
  builder,
@@ -5533,7 +5763,7 @@ var generateNormalVeScaMethod = ({
5533
5763
  veScaIds.treasury,
5534
5764
  scaCoin,
5535
5765
  unlockAtInSecondTimestamp,
5536
- SUI_CLOCK_OBJECT_ID5
5766
+ SUI_CLOCK_OBJECT_ID6
5537
5767
  ],
5538
5768
  []
5539
5769
  );
@@ -5547,7 +5777,7 @@ var generateNormalVeScaMethod = ({
5547
5777
  veScaIds.table,
5548
5778
  veScaIds.treasury,
5549
5779
  newUnlockAtInSecondTimestamp,
5550
- SUI_CLOCK_OBJECT_ID5
5780
+ SUI_CLOCK_OBJECT_ID6
5551
5781
  ],
5552
5782
  []
5553
5783
  );
@@ -5561,7 +5791,7 @@ var generateNormalVeScaMethod = ({
5561
5791
  veScaIds.table,
5562
5792
  veScaIds.treasury,
5563
5793
  scaCoin,
5564
- SUI_CLOCK_OBJECT_ID5
5794
+ SUI_CLOCK_OBJECT_ID6
5565
5795
  ],
5566
5796
  []
5567
5797
  );
@@ -5576,7 +5806,7 @@ var generateNormalVeScaMethod = ({
5576
5806
  veScaIds.treasury,
5577
5807
  scaCoin,
5578
5808
  newUnlockAtInSecondTimestamp,
5579
- SUI_CLOCK_OBJECT_ID5
5809
+ SUI_CLOCK_OBJECT_ID6
5580
5810
  ],
5581
5811
  []
5582
5812
  );
@@ -5589,7 +5819,7 @@ var generateNormalVeScaMethod = ({
5589
5819
  veScaKey,
5590
5820
  veScaIds.table,
5591
5821
  veScaIds.treasury,
5592
- SUI_CLOCK_OBJECT_ID5
5822
+ SUI_CLOCK_OBJECT_ID6
5593
5823
  ],
5594
5824
  []
5595
5825
  );
@@ -5744,7 +5974,7 @@ var generateQuickVeScaMethod = ({
5744
5974
  };
5745
5975
  };
5746
5976
  var newVeScaTxBlock = (builder, initTxBlock) => {
5747
- const txBlock = initTxBlock instanceof TransactionBlock3 ? new SuiKitTxBlock3(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock3();
5977
+ const txBlock = initTxBlock instanceof TransactionBlock4 ? new SuiKitTxBlock4(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock4();
5748
5978
  const normalMethod = generateNormalVeScaMethod({
5749
5979
  builder,
5750
5980
  txBlock
@@ -5771,241 +6001,6 @@ var newVeScaTxBlock = (builder, initTxBlock) => {
5771
6001
  });
5772
6002
  };
5773
6003
 
5774
- // src/builders/borrowIncentiveBuilder.ts
5775
- var requireObligationInfo2 = async (...params) => {
5776
- const [builder, txBlock, obligationId, obligationKey] = params;
5777
- if (params.length === 4 && obligationId && obligationKey && typeof obligationId === "string") {
5778
- const obligationLocked = await getObligationLocked(
5779
- builder.cache,
5780
- obligationId
5781
- );
5782
- return { obligationId, obligationKey, obligationLocked };
5783
- }
5784
- const sender = requireSender(txBlock);
5785
- const obligations = await getObligations(builder, sender);
5786
- if (obligations.length === 0) {
5787
- throw new Error(`No obligation found for sender ${sender}`);
5788
- }
5789
- const selectedObligation = obligations.find(
5790
- (obligation) => obligation.id === obligationId || obligation.keyId === obligationKey
5791
- ) ?? obligations[0];
5792
- return {
5793
- obligationId: selectedObligation.id,
5794
- obligationKey: selectedObligation.keyId,
5795
- obligationLocked: selectedObligation.locked
5796
- };
5797
- };
5798
- var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
5799
- const borrowIncentiveIds = {
5800
- borrowIncentivePkg: builder.address.get("borrowIncentive.id"),
5801
- query: builder.address.get("borrowIncentive.query"),
5802
- config: builder.address.get("borrowIncentive.config"),
5803
- incentivePools: builder.address.get("borrowIncentive.incentivePools"),
5804
- incentiveAccounts: builder.address.get(
5805
- "borrowIncentive.incentiveAccounts"
5806
- ),
5807
- obligationAccessStore: builder.address.get("core.obligationAccessStore")
5808
- };
5809
- const veScaIds = {
5810
- table: builder.address.get("vesca.table"),
5811
- treasury: builder.address.get("vesca.treasury"),
5812
- config: builder.address.get("vesca.config")
5813
- };
5814
- return {
5815
- stakeObligation: (obligationId, obligationKey) => {
5816
- txBlock.moveCall(
5817
- `${borrowIncentiveIds.borrowIncentivePkg}::user::stake`,
5818
- [
5819
- borrowIncentiveIds.config,
5820
- borrowIncentiveIds.incentivePools,
5821
- borrowIncentiveIds.incentiveAccounts,
5822
- obligationKey,
5823
- obligationId,
5824
- borrowIncentiveIds.obligationAccessStore,
5825
- SUI_CLOCK_OBJECT_ID6
5826
- ]
5827
- );
5828
- },
5829
- stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
5830
- txBlock.moveCall(
5831
- `${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca`,
5832
- [
5833
- borrowIncentiveIds.config,
5834
- borrowIncentiveIds.incentivePools,
5835
- borrowIncentiveIds.incentiveAccounts,
5836
- obligationKey,
5837
- obligationId,
5838
- borrowIncentiveIds.obligationAccessStore,
5839
- veScaIds.config,
5840
- veScaIds.treasury,
5841
- veScaIds.table,
5842
- veScaKey,
5843
- SUI_CLOCK_OBJECT_ID6
5844
- ],
5845
- []
5846
- );
5847
- },
5848
- unstakeObligation: (obligationId, obligationKey) => {
5849
- txBlock.moveCall(
5850
- `${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
5851
- [
5852
- borrowIncentiveIds.config,
5853
- borrowIncentiveIds.incentivePools,
5854
- borrowIncentiveIds.incentiveAccounts,
5855
- obligationKey,
5856
- obligationId,
5857
- SUI_CLOCK_OBJECT_ID6
5858
- ]
5859
- );
5860
- },
5861
- claimBorrowIncentive: (obligationId, obligationKey, coinName, rewardCoinName) => {
5862
- const rewardCoinNames = builder.utils.getBorrowIncentiveRewardCoinName(coinName);
5863
- if (rewardCoinNames.includes(rewardCoinName) === false) {
5864
- throw new Error(`Invalid reward coin name ${rewardCoinName}`);
5865
- }
5866
- const rewardType = builder.utils.parseCoinType(rewardCoinName);
5867
- return txBlock.moveCall(
5868
- `${borrowIncentiveIds.borrowIncentivePkg}::user::redeem_rewards`,
5869
- [
5870
- borrowIncentiveIds.config,
5871
- borrowIncentiveIds.incentivePools,
5872
- borrowIncentiveIds.incentiveAccounts,
5873
- obligationKey,
5874
- obligationId,
5875
- SUI_CLOCK_OBJECT_ID6
5876
- ],
5877
- [rewardType]
5878
- );
5879
- },
5880
- deactivateBoost: (obligation, veScaKey) => {
5881
- return txBlock.moveCall(
5882
- `${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
5883
- [
5884
- borrowIncentiveIds.config,
5885
- borrowIncentiveIds.incentivePools,
5886
- borrowIncentiveIds.incentiveAccounts,
5887
- obligation,
5888
- veScaKey,
5889
- SUI_CLOCK_OBJECT_ID6
5890
- ]
5891
- );
5892
- }
5893
- };
5894
- };
5895
- var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
5896
- return {
5897
- stakeObligationQuick: async (obligation, obligationKey) => {
5898
- const {
5899
- obligationId: obligationArg,
5900
- obligationKey: obligationKeyArg,
5901
- obligationLocked
5902
- } = await requireObligationInfo2(
5903
- builder,
5904
- txBlock,
5905
- obligation,
5906
- obligationKey
5907
- );
5908
- const unstakeObligationBeforeStake = !!txBlock.txBlock.blockData.transactions.find(
5909
- (txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
5910
- );
5911
- if (!obligationLocked || unstakeObligationBeforeStake) {
5912
- txBlock.stakeObligation(obligationArg, obligationKeyArg);
5913
- }
5914
- },
5915
- stakeObligationWithVeScaQuick: async (obligation, obligationKey, veScaKey) => {
5916
- const {
5917
- obligationId: obligationArg,
5918
- obligationKey: obligationKeyArg,
5919
- obligationLocked
5920
- } = await requireObligationInfo2(
5921
- builder,
5922
- txBlock,
5923
- obligation,
5924
- obligationKey
5925
- );
5926
- const unstakeObligationBeforeStake = !!txBlock.txBlock.blockData.transactions.find(
5927
- (txn) => txn.kind === "MoveCall" && (txn.target === `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` || txn.target === `${builder.address.get("borrowIncentive.id")}::user::unstake`)
5928
- );
5929
- if (!obligationLocked || unstakeObligationBeforeStake) {
5930
- const veSca = await requireVeSca(builder, txBlock, veScaKey);
5931
- if (veSca) {
5932
- const bindedObligationId = await getBindedObligationId(
5933
- builder,
5934
- veSca.keyId
5935
- );
5936
- if ((!bindedObligationId || bindedObligationId === obligationArg) && veSca.currentVeScaBalance > 0) {
5937
- txBlock.stakeObligationWithVesca(
5938
- obligationArg,
5939
- obligationKeyArg,
5940
- veSca.keyId
5941
- );
5942
- } else {
5943
- txBlock.stakeObligation(obligationArg, obligationKeyArg);
5944
- }
5945
- } else {
5946
- txBlock.stakeObligation(obligationArg, obligationKeyArg);
5947
- }
5948
- }
5949
- },
5950
- unstakeObligationQuick: async (obligation, obligationKey) => {
5951
- const {
5952
- obligationId: obligationArg,
5953
- obligationKey: obligationKeyArg,
5954
- obligationLocked
5955
- } = await requireObligationInfo2(
5956
- builder,
5957
- txBlock,
5958
- obligation,
5959
- obligationKey
5960
- );
5961
- if (obligationLocked) {
5962
- txBlock.unstakeObligation(obligationArg, obligationKeyArg);
5963
- }
5964
- },
5965
- claimBorrowIncentiveQuick: async (coinName, rewardCoinName, obligation, obligationKey) => {
5966
- const { obligationId: obligationArg, obligationKey: obligationKeyArg } = await requireObligationInfo2(
5967
- builder,
5968
- txBlock,
5969
- obligation,
5970
- obligationKey
5971
- );
5972
- return txBlock.claimBorrowIncentive(
5973
- obligationArg,
5974
- obligationKeyArg,
5975
- coinName,
5976
- rewardCoinName
5977
- );
5978
- }
5979
- };
5980
- };
5981
- var newBorrowIncentiveTxBlock = (builder, initTxBlock) => {
5982
- const txBlock = initTxBlock instanceof TransactionBlock4 ? new SuiKitTxBlock4(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock4();
5983
- const normalMethod = generateBorrowIncentiveNormalMethod({
5984
- builder,
5985
- txBlock
5986
- });
5987
- const normalTxBlock = new Proxy(txBlock, {
5988
- get: (target, prop) => {
5989
- if (prop in normalMethod) {
5990
- return Reflect.get(normalMethod, prop);
5991
- }
5992
- return Reflect.get(target, prop);
5993
- }
5994
- });
5995
- const quickMethod = generateBorrowIncentiveQuickMethod({
5996
- builder,
5997
- txBlock: normalTxBlock
5998
- });
5999
- return new Proxy(normalTxBlock, {
6000
- get: (target, prop) => {
6001
- if (prop in quickMethod) {
6002
- return Reflect.get(quickMethod, prop);
6003
- }
6004
- return Reflect.get(target, prop);
6005
- }
6006
- });
6007
- };
6008
-
6009
6004
  // src/builders/referralBuilder.ts
6010
6005
  import {
6011
6006
  SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID7,