@scallop-io/sui-scallop-sdk 0.46.49 → 0.46.51

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
@@ -330,7 +330,7 @@ var import_sui_kit = require("@scallop-io/sui-kit");
330
330
  var DEFAULT_CACHE_OPTIONS = {
331
331
  defaultOptions: {
332
332
  queries: {
333
- staleTime: 3e3
333
+ staleTime: 1500
334
334
  }
335
335
  }
336
336
  };
@@ -1603,11 +1603,11 @@ var ScallopAddress = class {
1603
1603
  };
1604
1604
 
1605
1605
  // src/models/scallopClient.ts
1606
- var import_utils23 = require("@mysten/sui.js/utils");
1606
+ var import_utils24 = require("@mysten/sui.js/utils");
1607
1607
  var import_sui_kit13 = require("@scallop-io/sui-kit");
1608
1608
 
1609
1609
  // src/models/scallopUtils.ts
1610
- var import_utils9 = require("@mysten/sui.js/utils");
1610
+ var import_utils10 = require("@mysten/sui.js/utils");
1611
1611
  var import_sui_kit4 = require("@scallop-io/sui-kit");
1612
1612
  var import_pyth_sui_js = require("@pythnetwork/pyth-sui-js");
1613
1613
 
@@ -2036,7 +2036,7 @@ var calculateBorrowIncentivePoolPointData = (parsedBorrowIncentivePoolData, pars
2036
2036
  (0, import_bignumber.default)(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
2037
2037
  weightScale
2038
2038
  )
2039
- ).dividedBy(weightedStakedValue).isFinite() ? rewardValueForYear.multipliedBy(
2039
+ ).dividedBy(weightedStakedValue).isFinite() && parsedBorrowIncentivePoolPointData.points > 0 ? rewardValueForYear.multipliedBy(
2040
2040
  (0, import_bignumber.default)(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
2041
2041
  weightScale
2042
2042
  )
@@ -3319,11 +3319,44 @@ var getPythPrice = async (query, assetCoinName, priceFeedObject) => {
3319
3319
  return 0;
3320
3320
  };
3321
3321
  var getPythPrices = async (query, assetCoinNames) => {
3322
+ const pythPriceFeedIds = assetCoinNames.reduce(
3323
+ (prev, assetCoinName) => {
3324
+ const pythPriceFeed = query.address.get(
3325
+ `core.coins.${assetCoinName}.oracle.pyth.feedObject`
3326
+ );
3327
+ if (!prev[pythPriceFeed]) {
3328
+ prev[pythPriceFeed] = [assetCoinName];
3329
+ } else {
3330
+ prev[pythPriceFeed].push(assetCoinName);
3331
+ }
3332
+ return prev;
3333
+ },
3334
+ {}
3335
+ );
3336
+ const priceFeedObjects = await query.cache.queryGetObjects(
3337
+ Object.keys(pythPriceFeedIds),
3338
+ { showContent: true }
3339
+ );
3340
+ const assetToPriceFeedMapping = priceFeedObjects.reduce(
3341
+ (prev, priceFeedObject) => {
3342
+ pythPriceFeedIds[priceFeedObject.objectId].forEach((assetCoinName) => {
3343
+ prev[assetCoinName] = priceFeedObject;
3344
+ });
3345
+ return prev;
3346
+ },
3347
+ {}
3348
+ );
3322
3349
  return (await Promise.all(
3323
- assetCoinNames.map(async (assetCoinName) => ({
3324
- coinName: assetCoinName,
3325
- price: await getPythPrice(query, assetCoinName)
3326
- }))
3350
+ Object.entries(assetToPriceFeedMapping).map(
3351
+ async ([assetCoinName, priceFeedObject]) => ({
3352
+ coinName: assetCoinName,
3353
+ price: await getPythPrice(
3354
+ query,
3355
+ assetCoinName,
3356
+ priceFeedObject
3357
+ )
3358
+ })
3359
+ )
3327
3360
  )).reduce(
3328
3361
  (prev, curr) => {
3329
3362
  prev[curr.coinName] = curr.price;
@@ -4297,6 +4330,7 @@ var getSCoinAmount = async (query, sCoinName, ownerAddress) => {
4297
4330
  };
4298
4331
 
4299
4332
  // src/models/scallopQuery.ts
4333
+ var import_utils9 = require("@mysten/sui.js/utils");
4300
4334
  var ScallopQuery = class {
4301
4335
  constructor(params, instance) {
4302
4336
  this.params = params;
@@ -4316,6 +4350,9 @@ var ScallopQuery = class {
4316
4350
  query: this
4317
4351
  });
4318
4352
  this.indexer = new ScallopIndexer(this.params, { cache: this.cache });
4353
+ this.walletAddress = (0, import_utils9.normalizeSuiAddress)(
4354
+ params?.walletAddress || this.suiKit.currentAddress()
4355
+ );
4319
4356
  }
4320
4357
  /**
4321
4358
  * Request the scallop API to initialize data.
@@ -4394,7 +4431,7 @@ var ScallopQuery = class {
4394
4431
  * @param ownerAddress - The owner address.
4395
4432
  * @return Obligations data.
4396
4433
  */
4397
- async getObligations(ownerAddress) {
4434
+ async getObligations(ownerAddress = this.walletAddress) {
4398
4435
  return await getObligations(this, ownerAddress);
4399
4436
  }
4400
4437
  /**
@@ -4413,7 +4450,7 @@ var ScallopQuery = class {
4413
4450
  * @param ownerAddress - The owner address.
4414
4451
  * @return All coin amounts.
4415
4452
  */
4416
- async getCoinAmounts(assetCoinNames, ownerAddress) {
4453
+ async getCoinAmounts(assetCoinNames, ownerAddress = this.walletAddress) {
4417
4454
  return await getCoinAmounts(this, assetCoinNames, ownerAddress);
4418
4455
  }
4419
4456
  /**
@@ -4423,7 +4460,7 @@ var ScallopQuery = class {
4423
4460
  * @param ownerAddress - The owner address.
4424
4461
  * @return Coin amount.
4425
4462
  */
4426
- async getCoinAmount(assetCoinName, ownerAddress) {
4463
+ async getCoinAmount(assetCoinName, ownerAddress = this.walletAddress) {
4427
4464
  return await getCoinAmount(this, assetCoinName, ownerAddress);
4428
4465
  }
4429
4466
  /**
@@ -4433,7 +4470,7 @@ var ScallopQuery = class {
4433
4470
  * @param ownerAddress - The owner address.
4434
4471
  * @return All market market coin amounts.
4435
4472
  */
4436
- async getMarketCoinAmounts(marketCoinNames, ownerAddress) {
4473
+ async getMarketCoinAmounts(marketCoinNames, ownerAddress = this.walletAddress) {
4437
4474
  return await getMarketCoinAmounts(this, marketCoinNames, ownerAddress);
4438
4475
  }
4439
4476
  /**
@@ -4443,7 +4480,7 @@ var ScallopQuery = class {
4443
4480
  * @param ownerAddress - The owner address.
4444
4481
  * @return Market market coin amount.
4445
4482
  */
4446
- async getMarketCoinAmount(marketCoinName, ownerAddress) {
4483
+ async getMarketCoinAmount(marketCoinName, ownerAddress = this.walletAddress) {
4447
4484
  return await getMarketCoinAmount(this, marketCoinName, ownerAddress);
4448
4485
  }
4449
4486
  /**
@@ -4491,7 +4528,7 @@ var ScallopQuery = class {
4491
4528
  * @param ownerAddress - The owner address.
4492
4529
  * @return All Stake accounts data.
4493
4530
  */
4494
- async getAllStakeAccounts(ownerAddress) {
4531
+ async getAllStakeAccounts(ownerAddress = this.walletAddress) {
4495
4532
  return await getStakeAccounts(this, ownerAddress);
4496
4533
  }
4497
4534
  /**
@@ -4501,7 +4538,7 @@ var ScallopQuery = class {
4501
4538
  * @param ownerAddress - The owner address.
4502
4539
  * @return Stake accounts data.
4503
4540
  */
4504
- async getStakeAccounts(stakeMarketCoinName, ownerAddress) {
4541
+ async getStakeAccounts(stakeMarketCoinName, ownerAddress = this.walletAddress) {
4505
4542
  const allStakeAccount = await this.getAllStakeAccounts(ownerAddress);
4506
4543
  return allStakeAccount[stakeMarketCoinName] ?? [];
4507
4544
  }
@@ -4606,7 +4643,7 @@ var ScallopQuery = class {
4606
4643
  * @param indexer - Whether to use indexer.
4607
4644
  * @return All lending and spool infomation.
4608
4645
  */
4609
- async getLendings(poolCoinNames, ownerAddress, indexer = false) {
4646
+ async getLendings(poolCoinNames, ownerAddress = this.walletAddress, indexer = false) {
4610
4647
  return await getLendings(this, poolCoinNames, ownerAddress, indexer);
4611
4648
  }
4612
4649
  /**
@@ -4617,7 +4654,7 @@ var ScallopQuery = class {
4617
4654
  * @param indexer - Whether to use indexer.
4618
4655
  * @return Lending pool data.
4619
4656
  */
4620
- async getLending(poolCoinName, ownerAddress, indexer = false) {
4657
+ async getLending(poolCoinName, ownerAddress = this.walletAddress, indexer = false) {
4621
4658
  return await getLending(this, poolCoinName, ownerAddress, indexer);
4622
4659
  }
4623
4660
  /**
@@ -4630,7 +4667,7 @@ var ScallopQuery = class {
4630
4667
  * @param indexer - Whether to use indexer.
4631
4668
  * @return All obligation accounts information.
4632
4669
  */
4633
- async getObligationAccounts(ownerAddress, indexer = false) {
4670
+ async getObligationAccounts(ownerAddress = this.walletAddress, indexer = false) {
4634
4671
  return await getObligationAccounts(this, ownerAddress, indexer);
4635
4672
  }
4636
4673
  /**
@@ -4644,7 +4681,7 @@ var ScallopQuery = class {
4644
4681
  * @param indexer - Whether to use indexer.
4645
4682
  * @return Borrowing and collateral information.
4646
4683
  */
4647
- async getObligationAccount(obligationId, ownerAddress, indexer = false) {
4684
+ async getObligationAccount(obligationId, ownerAddress = this.walletAddress, indexer = false) {
4648
4685
  return await getObligationAccount(
4649
4686
  this,
4650
4687
  obligationId,
@@ -4726,7 +4763,7 @@ var ScallopQuery = class {
4726
4763
  * @param ownerAddress - The owner address.
4727
4764
  * @return All market sCoin amounts.
4728
4765
  */
4729
- async getSCoinAmounts(sCoinNames, ownerAddress) {
4766
+ async getSCoinAmounts(sCoinNames, ownerAddress = this.walletAddress) {
4730
4767
  return await getSCoinAmounts(this, sCoinNames, ownerAddress);
4731
4768
  }
4732
4769
  /**
@@ -4736,7 +4773,7 @@ var ScallopQuery = class {
4736
4773
  * @param ownerAddress - The owner address.
4737
4774
  * @return sCoin amount.
4738
4775
  */
4739
- async getSCoinAmount(sCoinName, ownerAddress) {
4776
+ async getSCoinAmount(sCoinName, ownerAddress = this.walletAddress) {
4740
4777
  const parsedSCoinName = this.utils.parseSCoinName(sCoinName);
4741
4778
  return parsedSCoinName ? await getSCoinAmount(this, parsedSCoinName, ownerAddress) : 0;
4742
4779
  }
@@ -4841,7 +4878,7 @@ var ScallopUtils = class {
4841
4878
  throw Error(`Coin ${coinName} is not supported`);
4842
4879
  }
4843
4880
  if (coinName === "sui")
4844
- return (0, import_utils9.normalizeStructTag)(`${coinPackageId}::sui::SUI`);
4881
+ return (0, import_utils10.normalizeStructTag)(`${coinPackageId}::sui::SUI`);
4845
4882
  const wormHolePckageIds = [
4846
4883
  this._address.get("core.coins.usdc.id") ?? wormholeCoinIds.usdc,
4847
4884
  this._address.get("core.coins.usdt.id") ?? wormholeCoinIds.usdt,
@@ -4916,7 +4953,7 @@ var ScallopUtils = class {
4916
4953
  return `${protocolObjectId}::reserve::MarketCoin<${coinType}>`;
4917
4954
  }
4918
4955
  parseCoinNameFromType(coinType) {
4919
- coinType = (0, import_utils9.normalizeStructTag)(coinType);
4956
+ coinType = (0, import_utils10.normalizeStructTag)(coinType);
4920
4957
  const coinTypeRegex = new RegExp(`((0x[^:]+::[^:]+::[^<>]+))(?![^<>]*<)`);
4921
4958
  const coinTypeMatch = coinType.match(coinTypeRegex);
4922
4959
  const isMarketCoinType = coinType.includes("reserve::MarketCoin");
@@ -4980,7 +5017,7 @@ var ScallopUtils = class {
4980
5017
  * @param coinType - The coin type, default is 0x2::SUI::SUI.
4981
5018
  * @return The selected transaction coin arguments.
4982
5019
  */
4983
- async selectCoins(amount, coinType = import_utils9.SUI_TYPE_ARG, ownerAddress) {
5020
+ async selectCoins(amount, coinType = import_utils10.SUI_TYPE_ARG, ownerAddress) {
4984
5021
  ownerAddress = ownerAddress || this._suiKit.currentAddress();
4985
5022
  const coins = await this._suiKit.suiInteractor.selectCoins(
4986
5023
  ownerAddress,
@@ -5161,16 +5198,16 @@ var ScallopUtils = class {
5161
5198
  };
5162
5199
 
5163
5200
  // src/models/scallopBuilder.ts
5164
- var import_utils22 = require("@mysten/sui.js/utils");
5201
+ var import_utils23 = require("@mysten/sui.js/utils");
5165
5202
  var import_sui_kit12 = require("@scallop-io/sui-kit");
5166
5203
 
5167
5204
  // src/builders/coreBuilder.ts
5168
5205
  var import_transactions = require("@mysten/sui.js/transactions");
5169
- var import_utils12 = require("@mysten/sui.js/utils");
5206
+ var import_utils13 = require("@mysten/sui.js/utils");
5170
5207
  var import_sui_kit5 = require("@scallop-io/sui-kit");
5171
5208
 
5172
5209
  // src/builders/oracle.ts
5173
- var import_utils11 = require("@mysten/sui.js/utils");
5210
+ var import_utils12 = require("@mysten/sui.js/utils");
5174
5211
  var import_pyth_sui_js2 = require("@pythnetwork/pyth-sui-js");
5175
5212
  var updateOracles = async (builder, txBlock, assetCoinNames) => {
5176
5213
  assetCoinNames = assetCoinNames ?? [
@@ -5284,27 +5321,27 @@ var priceUpdateRequest = (txBlock, packageId, xOracleId, coinType) => {
5284
5321
  var confirmPriceUpdateRequest = (txBlock, packageId, xOracleId, request, coinType) => {
5285
5322
  const target = `${packageId}::x_oracle::confirm_price_update_request`;
5286
5323
  const typeArgs = [coinType];
5287
- txBlock.moveCall(target, [xOracleId, request, import_utils11.SUI_CLOCK_OBJECT_ID], typeArgs);
5324
+ txBlock.moveCall(target, [xOracleId, request, import_utils12.SUI_CLOCK_OBJECT_ID], typeArgs);
5288
5325
  return txBlock;
5289
5326
  };
5290
5327
  var updateSupraPrice = (txBlock, packageId, request, holderId, registryId, coinType) => {
5291
5328
  txBlock.moveCall(
5292
5329
  `${packageId}::rule::set_price`,
5293
- [request, holderId, registryId, import_utils11.SUI_CLOCK_OBJECT_ID],
5330
+ [request, holderId, registryId, import_utils12.SUI_CLOCK_OBJECT_ID],
5294
5331
  [coinType]
5295
5332
  );
5296
5333
  };
5297
5334
  var updateSwitchboardPrice = (txBlock, packageId, request, aggregatorId, registryId, coinType) => {
5298
5335
  txBlock.moveCall(
5299
5336
  `${packageId}::rule::set_price`,
5300
- [request, aggregatorId, registryId, import_utils11.SUI_CLOCK_OBJECT_ID],
5337
+ [request, aggregatorId, registryId, import_utils12.SUI_CLOCK_OBJECT_ID],
5301
5338
  [coinType]
5302
5339
  );
5303
5340
  };
5304
5341
  var updatePythPrice = (txBlock, packageId, request, stateId, feedObjectId, registryId, coinType) => {
5305
5342
  txBlock.moveCall(
5306
5343
  `${packageId}::rule::set_price`,
5307
- [request, stateId, feedObjectId, registryId, import_utils11.SUI_CLOCK_OBJECT_ID],
5344
+ [request, stateId, feedObjectId, registryId, import_utils12.SUI_CLOCK_OBJECT_ID],
5308
5345
  [coinType]
5309
5346
  );
5310
5347
  };
@@ -5375,7 +5412,7 @@ var generateCoreNormalMethod = ({
5375
5412
  coreIds.coinDecimalsRegistry,
5376
5413
  amount,
5377
5414
  coreIds.xOracle,
5378
- import_utils12.SUI_CLOCK_OBJECT_ID
5415
+ import_utils13.SUI_CLOCK_OBJECT_ID
5379
5416
  ],
5380
5417
  [coinType]
5381
5418
  );
@@ -5384,7 +5421,7 @@ var generateCoreNormalMethod = ({
5384
5421
  const coinType = builder.utils.parseCoinType(poolCoinName);
5385
5422
  return txBlock.moveCall(
5386
5423
  `${coreIds.protocolPkg}::mint::mint`,
5387
- [coreIds.version, coreIds.market, coin, import_utils12.SUI_CLOCK_OBJECT_ID],
5424
+ [coreIds.version, coreIds.market, coin, import_utils13.SUI_CLOCK_OBJECT_ID],
5388
5425
  [coinType]
5389
5426
  );
5390
5427
  },
@@ -5392,7 +5429,7 @@ var generateCoreNormalMethod = ({
5392
5429
  const coinType = builder.utils.parseCoinType(poolCoinName);
5393
5430
  return txBlock.moveCall(
5394
5431
  `${coreIds.protocolPkg}::mint::mint_entry`,
5395
- [coreIds.version, coreIds.market, coin, import_utils12.SUI_CLOCK_OBJECT_ID],
5432
+ [coreIds.version, coreIds.market, coin, import_utils13.SUI_CLOCK_OBJECT_ID],
5396
5433
  [coinType]
5397
5434
  );
5398
5435
  },
@@ -5400,7 +5437,7 @@ var generateCoreNormalMethod = ({
5400
5437
  const coinType = builder.utils.parseCoinType(poolCoinName);
5401
5438
  return txBlock.moveCall(
5402
5439
  `${coreIds.protocolPkg}::redeem::redeem`,
5403
- [coreIds.version, coreIds.market, marketCoin, import_utils12.SUI_CLOCK_OBJECT_ID],
5440
+ [coreIds.version, coreIds.market, marketCoin, import_utils13.SUI_CLOCK_OBJECT_ID],
5404
5441
  [coinType]
5405
5442
  );
5406
5443
  },
@@ -5408,7 +5445,7 @@ var generateCoreNormalMethod = ({
5408
5445
  const coinType = builder.utils.parseCoinType(poolCoinName);
5409
5446
  return txBlock.moveCall(
5410
5447
  `${coreIds.protocolPkg}::redeem::redeem_entry`,
5411
- [coreIds.version, coreIds.market, marketCoin, import_utils12.SUI_CLOCK_OBJECT_ID],
5448
+ [coreIds.version, coreIds.market, marketCoin, import_utils13.SUI_CLOCK_OBJECT_ID],
5412
5449
  [coinType]
5413
5450
  );
5414
5451
  },
@@ -5424,7 +5461,7 @@ var generateCoreNormalMethod = ({
5424
5461
  coreIds.coinDecimalsRegistry,
5425
5462
  amount,
5426
5463
  coreIds.xOracle,
5427
- import_utils12.SUI_CLOCK_OBJECT_ID
5464
+ import_utils13.SUI_CLOCK_OBJECT_ID
5428
5465
  ],
5429
5466
  [coinType]
5430
5467
  );
@@ -5442,7 +5479,7 @@ var generateCoreNormalMethod = ({
5442
5479
  borrowReferral,
5443
5480
  amount,
5444
5481
  coreIds.xOracle,
5445
- import_utils12.SUI_CLOCK_OBJECT_ID
5482
+ import_utils13.SUI_CLOCK_OBJECT_ID
5446
5483
  ],
5447
5484
  [coinType, referralWitnessType]
5448
5485
  );
@@ -5459,7 +5496,7 @@ var generateCoreNormalMethod = ({
5459
5496
  coreIds.coinDecimalsRegistry,
5460
5497
  amount,
5461
5498
  coreIds.xOracle,
5462
- import_utils12.SUI_CLOCK_OBJECT_ID
5499
+ import_utils13.SUI_CLOCK_OBJECT_ID
5463
5500
  ],
5464
5501
  [coinType]
5465
5502
  );
@@ -5473,7 +5510,7 @@ var generateCoreNormalMethod = ({
5473
5510
  obligation,
5474
5511
  coreIds.market,
5475
5512
  coin,
5476
- import_utils12.SUI_CLOCK_OBJECT_ID
5513
+ import_utils13.SUI_CLOCK_OBJECT_ID
5477
5514
  ],
5478
5515
  [coinType]
5479
5516
  );
@@ -5708,7 +5745,7 @@ var newCoreTxBlock = (builder, initTxBlock) => {
5708
5745
 
5709
5746
  // src/builders/spoolBuilder.ts
5710
5747
  var import_transactions2 = require("@mysten/sui.js/transactions");
5711
- var import_utils14 = require("@mysten/sui.js/utils");
5748
+ var import_utils15 = require("@mysten/sui.js/utils");
5712
5749
  var import_sui_kit6 = require("@scallop-io/sui-kit");
5713
5750
  var requireStakeAccountIds = async (...params) => {
5714
5751
  const [builder, txBlock, stakeMarketCoinName, stakeAccountId] = params;
@@ -5764,7 +5801,7 @@ var generateSpoolNormalMethod = ({
5764
5801
  );
5765
5802
  return txBlock.moveCall(
5766
5803
  `${spoolIds.spoolPkg}::user::new_spool_account`,
5767
- [stakePoolId, import_utils14.SUI_CLOCK_OBJECT_ID],
5804
+ [stakePoolId, import_utils15.SUI_CLOCK_OBJECT_ID],
5768
5805
  [marketCoinType]
5769
5806
  );
5770
5807
  },
@@ -5775,7 +5812,7 @@ var generateSpoolNormalMethod = ({
5775
5812
  );
5776
5813
  txBlock.moveCall(
5777
5814
  `${spoolIds.spoolPkg}::user::stake`,
5778
- [stakePoolId, stakeAccount, coin, import_utils14.SUI_CLOCK_OBJECT_ID],
5815
+ [stakePoolId, stakeAccount, coin, import_utils15.SUI_CLOCK_OBJECT_ID],
5779
5816
  [marketCoinType]
5780
5817
  );
5781
5818
  },
@@ -5786,7 +5823,7 @@ var generateSpoolNormalMethod = ({
5786
5823
  );
5787
5824
  return txBlock.moveCall(
5788
5825
  `${spoolIds.spoolPkg}::user::unstake`,
5789
- [stakePoolId, stakeAccount, amount, import_utils14.SUI_CLOCK_OBJECT_ID],
5826
+ [stakePoolId, stakeAccount, amount, import_utils15.SUI_CLOCK_OBJECT_ID],
5790
5827
  [marketCoinType]
5791
5828
  );
5792
5829
  },
@@ -5802,7 +5839,7 @@ var generateSpoolNormalMethod = ({
5802
5839
  const rewardCoinType = builder.utils.parseCoinType(rewardCoinName);
5803
5840
  return txBlock.moveCall(
5804
5841
  `${spoolIds.spoolPkg}::user::redeem_rewards`,
5805
- [stakePoolId, rewardPoolId, stakeAccount, import_utils14.SUI_CLOCK_OBJECT_ID],
5842
+ [stakePoolId, rewardPoolId, stakeAccount, import_utils15.SUI_CLOCK_OBJECT_ID],
5806
5843
  [marketCoinType, rewardCoinType]
5807
5844
  );
5808
5845
  }
@@ -5959,7 +5996,7 @@ var newSpoolTxBlock = (builder, initTxBlock) => {
5959
5996
 
5960
5997
  // src/builders/borrowIncentiveBuilder.ts
5961
5998
  var import_transactions3 = require("@mysten/sui.js/transactions");
5962
- var import_utils17 = require("@mysten/sui.js/utils");
5999
+ var import_utils18 = require("@mysten/sui.js/utils");
5963
6000
  var import_sui_kit8 = require("@scallop-io/sui-kit");
5964
6001
 
5965
6002
  // src/builders/vescaBuilder.ts
@@ -6285,7 +6322,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
6285
6322
  obligationKey,
6286
6323
  obligationId,
6287
6324
  borrowIncentiveIds.obligationAccessStore,
6288
- import_utils17.SUI_CLOCK_OBJECT_ID
6325
+ import_utils18.SUI_CLOCK_OBJECT_ID
6289
6326
  ]
6290
6327
  );
6291
6328
  },
@@ -6303,7 +6340,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
6303
6340
  veScaIds.treasury,
6304
6341
  veScaIds.table,
6305
6342
  veScaKey,
6306
- import_utils17.SUI_CLOCK_OBJECT_ID
6343
+ import_utils18.SUI_CLOCK_OBJECT_ID
6307
6344
  ],
6308
6345
  []
6309
6346
  );
@@ -6317,7 +6354,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
6317
6354
  borrowIncentiveIds.incentiveAccounts,
6318
6355
  obligationKey,
6319
6356
  obligationId,
6320
- import_utils17.SUI_CLOCK_OBJECT_ID
6357
+ import_utils18.SUI_CLOCK_OBJECT_ID
6321
6358
  ]
6322
6359
  );
6323
6360
  },
@@ -6335,7 +6372,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
6335
6372
  borrowIncentiveIds.incentiveAccounts,
6336
6373
  obligationKey,
6337
6374
  obligationId,
6338
- import_utils17.SUI_CLOCK_OBJECT_ID
6375
+ import_utils18.SUI_CLOCK_OBJECT_ID
6339
6376
  ],
6340
6377
  [rewardType]
6341
6378
  );
@@ -6349,7 +6386,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
6349
6386
  borrowIncentiveIds.incentiveAccounts,
6350
6387
  obligation,
6351
6388
  veScaKey,
6352
- import_utils17.SUI_CLOCK_OBJECT_ID
6389
+ import_utils18.SUI_CLOCK_OBJECT_ID
6353
6390
  ]
6354
6391
  );
6355
6392
  }
@@ -6828,7 +6865,7 @@ var ScallopBuilder = class {
6828
6865
  query: this.query,
6829
6866
  cache: this.cache
6830
6867
  });
6831
- this.walletAddress = (0, import_utils22.normalizeSuiAddress)(
6868
+ this.walletAddress = (0, import_utils23.normalizeSuiAddress)(
6832
6869
  params?.walletAddress || this.suiKit.currentAddress()
6833
6870
  );
6834
6871
  this.isTestnet = params.networkType ? params.networkType === "testnet" : false;
@@ -6866,7 +6903,7 @@ var ScallopBuilder = class {
6866
6903
  * @param sender - Sender address.
6867
6904
  * @return Take coin and left coin.
6868
6905
  */
6869
- async selectCoin(txBlock, assetCoinName, amount, sender) {
6906
+ async selectCoin(txBlock, assetCoinName, amount, sender = this.walletAddress) {
6870
6907
  const coinType = this.utils.parseCoinType(assetCoinName);
6871
6908
  const coins = await this.utils.selectCoins(amount, coinType, sender);
6872
6909
  const [takeCoin, leftCoin] = txBlock.takeAmountFromCoins(coins, amount);
@@ -6881,7 +6918,7 @@ var ScallopBuilder = class {
6881
6918
  * @param sender - Sender address.
6882
6919
  * @return Take coin and left coin.
6883
6920
  */
6884
- async selectMarketCoin(txBlock, marketCoinName, amount, sender) {
6921
+ async selectMarketCoin(txBlock, marketCoinName, amount, sender = this.walletAddress) {
6885
6922
  const marketCoinType = this.utils.parseMarketCoinType(marketCoinName);
6886
6923
  const coins = await this.utils.selectCoins(amount, marketCoinType, sender);
6887
6924
  const totalAmount = coins.reduce((prev, coin) => {
@@ -6903,7 +6940,7 @@ var ScallopBuilder = class {
6903
6940
  * @param sender - Sender address.
6904
6941
  * @return Take coin and left coin.
6905
6942
  */
6906
- async selectSCoin(txBlock, sCoinName, amount, sender) {
6943
+ async selectSCoin(txBlock, sCoinName, amount, sender = this.walletAddress) {
6907
6944
  const sCoinType = this.utils.parseSCoinType(sCoinName);
6908
6945
  const coins = await this.utils.selectCoins(amount, sCoinType, sender);
6909
6946
  const totalAmount = coins.reduce((prev, coin) => {
@@ -6963,7 +7000,7 @@ var ScallopClient = class {
6963
7000
  utils: this.utils,
6964
7001
  cache: this.cache
6965
7002
  });
6966
- this.walletAddress = (0, import_utils23.normalizeSuiAddress)(
7003
+ this.walletAddress = (0, import_utils24.normalizeSuiAddress)(
6967
7004
  params?.walletAddress || this.suiKit.currentAddress()
6968
7005
  );
6969
7006
  }