@t2000/sdk 1.24.0 → 1.24.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.cjs CHANGED
@@ -5636,6 +5636,14 @@ async function maxBorrowAmount(client, address) {
5636
5636
  const maxAmount = Math.max(0, hf.supplied * ltv / MIN_HEALTH_FACTOR - hf.borrowed);
5637
5637
  return { maxAmount, healthFactorAfter: MIN_HEALTH_FACTOR, currentHF: hf.healthFactor };
5638
5638
  }
5639
+ async function getPendingRewardsByAddress(address, suiRpcUrl) {
5640
+ const { SuiJsonRpcClient: SuiJsonRpcClient2, getJsonRpcFullnodeUrl: getJsonRpcFullnodeUrl2 } = await import('@mysten/sui/jsonRpc');
5641
+ const client = new SuiJsonRpcClient2({
5642
+ url: suiRpcUrl ?? getJsonRpcFullnodeUrl2("mainnet"),
5643
+ network: "mainnet"
5644
+ });
5645
+ return getPendingRewards(client, address);
5646
+ }
5639
5647
  async function getPendingRewards(client, address) {
5640
5648
  let rewards;
5641
5649
  try {
@@ -7560,7 +7568,8 @@ async function addHarvestToTx(tx, client, address, options = {}) {
7560
7568
  amount: aggRow.amount,
7561
7569
  slippage,
7562
7570
  inputCoin: coin,
7563
- providers: options.providers
7571
+ providers: options.providers,
7572
+ overlayFee: options.overlayFee
7564
7573
  });
7565
7574
  usdcHandles.push(swapResult.coin);
7566
7575
  expectedUsdcDeposited += swapResult.expectedAmountOut;
@@ -7594,6 +7603,14 @@ async function addHarvestToTx(tx, client, address, options = {}) {
7594
7603
  tx.mergeCoins(primary, rest);
7595
7604
  depositCoin = primary;
7596
7605
  }
7606
+ if (options.saveFeeHook) {
7607
+ await options.saveFeeHook({
7608
+ tx,
7609
+ coin: depositCoin,
7610
+ input: { asset: "USDC", amount: expectedUsdcDeposited },
7611
+ sender: address
7612
+ });
7613
+ }
7597
7614
  try {
7598
7615
  await addSaveToTx(tx, client, address, depositCoin, { asset: "USDC" });
7599
7616
  } catch (err) {
@@ -7831,7 +7848,9 @@ var WRITE_APPENDER_REGISTRY = {
7831
7848
  const plan = await addHarvestToTx(tx, ctx.client, ctx.sender, {
7832
7849
  slippage: input.slippage,
7833
7850
  minRewardUsd: input.minRewardUsd,
7834
- providers
7851
+ providers,
7852
+ overlayFee: ctx.overlayFee,
7853
+ saveFeeHook: ctx.feeHooks?.save_deposit
7835
7854
  });
7836
7855
  return {
7837
7856
  preview: {
@@ -8332,6 +8351,7 @@ exports.getDecimals = getDecimals;
8332
8351
  exports.getDecimalsForCoinType = getDecimalsForCoinType;
8333
8352
  exports.getFinancialSummary = getFinancialSummary;
8334
8353
  exports.getPendingRewards = getPendingRewards;
8354
+ exports.getPendingRewardsByAddress = getPendingRewardsByAddress;
8335
8355
  exports.getRates = getRates;
8336
8356
  exports.getSwapQuote = getSwapQuote;
8337
8357
  exports.getTier = getTier;