@t2000/sdk 1.0.0 → 1.0.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.
@@ -1,5 +1,5 @@
1
- import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-3YmGYl63.cjs';
2
- export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-3YmGYl63.cjs';
1
+ import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-CDVXo3BM.cjs';
2
+ export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-CDVXo3BM.cjs';
3
3
  import { b as MaxWithdrawResult, M as MaxBorrowResult } from '../types-jAD-e7Pq.cjs';
4
4
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
5
5
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
@@ -58,25 +58,33 @@ declare class NaviAdapter implements LendingAdapter {
58
58
  buildSaveTx(address: string, amount: number, asset: string, options?: {
59
59
  collectFee?: boolean;
60
60
  }): Promise<AdapterTxResult>;
61
- buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
61
+ buildWithdrawTx(address: string, amount: number, asset: string, options?: {
62
+ skipPythUpdate?: boolean;
63
+ }): Promise<AdapterTxResult & {
62
64
  effectiveAmount: number;
63
65
  }>;
64
66
  buildBorrowTx(address: string, amount: number, asset: string, options?: {
65
67
  collectFee?: boolean;
68
+ skipPythUpdate?: boolean;
66
69
  }): Promise<AdapterTxResult>;
67
70
  buildRepayTx(address: string, amount: number, asset: string, options?: {
68
71
  skipOracle?: boolean;
72
+ skipPythUpdate?: boolean;
69
73
  }): Promise<AdapterTxResult>;
70
74
  maxWithdraw(address: string, _asset: string): Promise<MaxWithdrawResult>;
71
75
  maxBorrow(address: string, _asset: string): Promise<MaxBorrowResult>;
72
- addWithdrawToTx(tx: Transaction, address: string, amount: number, asset: string): Promise<{
76
+ addWithdrawToTx(tx: Transaction, address: string, amount: number, asset: string, options?: {
77
+ skipPythUpdate?: boolean;
78
+ }): Promise<{
73
79
  coin: TransactionObjectArgument;
74
80
  effectiveAmount: number;
75
81
  }>;
76
82
  addSaveToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
77
83
  collectFee?: boolean;
78
84
  }): Promise<void>;
79
- addRepayToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string): Promise<void>;
85
+ addRepayToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
86
+ skipPythUpdate?: boolean;
87
+ }): Promise<void>;
80
88
  getPendingRewards(address: string): Promise<PendingReward[]>;
81
89
  addClaimRewardsToTx(tx: Transaction, address: string): Promise<PendingReward[]>;
82
90
  }
@@ -1,5 +1,5 @@
1
- import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-3YmGYl63.js';
2
- export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-3YmGYl63.js';
1
+ import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-CDVXo3BM.js';
2
+ export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-CDVXo3BM.js';
3
3
  import { b as MaxWithdrawResult, M as MaxBorrowResult } from '../types-jAD-e7Pq.js';
4
4
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
5
5
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
@@ -58,25 +58,33 @@ declare class NaviAdapter implements LendingAdapter {
58
58
  buildSaveTx(address: string, amount: number, asset: string, options?: {
59
59
  collectFee?: boolean;
60
60
  }): Promise<AdapterTxResult>;
61
- buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
61
+ buildWithdrawTx(address: string, amount: number, asset: string, options?: {
62
+ skipPythUpdate?: boolean;
63
+ }): Promise<AdapterTxResult & {
62
64
  effectiveAmount: number;
63
65
  }>;
64
66
  buildBorrowTx(address: string, amount: number, asset: string, options?: {
65
67
  collectFee?: boolean;
68
+ skipPythUpdate?: boolean;
66
69
  }): Promise<AdapterTxResult>;
67
70
  buildRepayTx(address: string, amount: number, asset: string, options?: {
68
71
  skipOracle?: boolean;
72
+ skipPythUpdate?: boolean;
69
73
  }): Promise<AdapterTxResult>;
70
74
  maxWithdraw(address: string, _asset: string): Promise<MaxWithdrawResult>;
71
75
  maxBorrow(address: string, _asset: string): Promise<MaxBorrowResult>;
72
- addWithdrawToTx(tx: Transaction, address: string, amount: number, asset: string): Promise<{
76
+ addWithdrawToTx(tx: Transaction, address: string, amount: number, asset: string, options?: {
77
+ skipPythUpdate?: boolean;
78
+ }): Promise<{
73
79
  coin: TransactionObjectArgument;
74
80
  effectiveAmount: number;
75
81
  }>;
76
82
  addSaveToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
77
83
  collectFee?: boolean;
78
84
  }): Promise<void>;
79
- addRepayToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string): Promise<void>;
85
+ addRepayToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
86
+ skipPythUpdate?: boolean;
87
+ }): Promise<void>;
80
88
  getPendingRewards(address: string): Promise<PendingReward[]>;
81
89
  addClaimRewardsToTx(tx: Transaction, address: string): Promise<PendingReward[]>;
82
90
  }
@@ -4465,7 +4465,7 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
4465
4465
  }
4466
4466
  const tx = new Transaction();
4467
4467
  tx.setSender(address);
4468
- await refreshOracle(tx, client, address);
4468
+ await refreshOracle(tx, client, address, { skipPythUpdate: options.skipPythUpdate });
4469
4469
  try {
4470
4470
  const coin = await Qe(tx, assetInfo.type, rawAmount, sdkOptions(client));
4471
4471
  tx.transferObjects([coin], address);
@@ -4494,7 +4494,7 @@ async function addWithdrawToTx(tx, client, address, amount, options = {}) {
4494
4494
  });
4495
4495
  return { coin, effectiveAmount: 0 };
4496
4496
  }
4497
- await refreshOracle(tx, client, address);
4497
+ await refreshOracle(tx, client, address, { skipPythUpdate: options.skipPythUpdate });
4498
4498
  try {
4499
4499
  const coin = await Qe(tx, assetInfo.type, rawAmount, sdkOptions(client));
4500
4500
  return { coin, effectiveAmount };
@@ -4519,7 +4519,7 @@ async function addSaveToTx(tx, _client, _address, coin, options = {}) {
4519
4519
  async function addRepayToTx(tx, client, address, coin, options = {}) {
4520
4520
  const asset = options.asset ?? "USDC";
4521
4521
  const assetInfo = resolveAssetInfo(asset);
4522
- await refreshOracle(tx, client, address);
4522
+ await refreshOracle(tx, client, address, { skipPythUpdate: options.skipPythUpdate });
4523
4523
  try {
4524
4524
  await xe(tx, assetInfo.type, coin, { env: "prod" });
4525
4525
  } catch (err) {
@@ -4536,7 +4536,7 @@ async function buildBorrowTx(client, address, amount, options = {}) {
4536
4536
  const rawAmount = Number(stableToRaw(amount, assetInfo.decimals));
4537
4537
  const tx = new Transaction();
4538
4538
  tx.setSender(address);
4539
- await refreshOracle(tx, client, address);
4539
+ await refreshOracle(tx, client, address, { skipPythUpdate: options.skipPythUpdate });
4540
4540
  try {
4541
4541
  const borrowedCoin = await Xe(tx, assetInfo.type, rawAmount, sdkOptions(client));
4542
4542
  if (options.collectFee) {
@@ -4567,7 +4567,10 @@ async function buildRepayTx(client, address, amount, options = {}) {
4567
4567
  const coinObj = mergeCoins(tx, coins);
4568
4568
  const rawAmount = Math.min(rawRequested, Number(totalBalance));
4569
4569
  const [repayCoin] = tx.splitCoins(coinObj, [rawAmount]);
4570
- await refreshOracle(tx, client, address, { skipOracle: options.skipOracle });
4570
+ await refreshOracle(tx, client, address, {
4571
+ skipOracle: options.skipOracle,
4572
+ skipPythUpdate: options.skipPythUpdate
4573
+ });
4571
4574
  try {
4572
4575
  await xe(tx, assetInfo.type, repayCoin, {
4573
4576
  ...sdkOptions(client),
@@ -4730,9 +4733,12 @@ var NaviAdapter = class {
4730
4733
  const tx = await buildSaveTx(this.client, address, amount, { ...options, asset: normalized });
4731
4734
  return { tx };
4732
4735
  }
4733
- async buildWithdrawTx(address, amount, asset) {
4736
+ async buildWithdrawTx(address, amount, asset, options) {
4734
4737
  const normalized = normalizeAsset(asset);
4735
- const result = await buildWithdrawTx(this.client, address, amount, { asset: normalized });
4738
+ const result = await buildWithdrawTx(this.client, address, amount, {
4739
+ asset: normalized,
4740
+ skipPythUpdate: options?.skipPythUpdate
4741
+ });
4736
4742
  return { tx: result.tx, effectiveAmount: result.effectiveAmount };
4737
4743
  }
4738
4744
  async buildBorrowTx(address, amount, asset, options) {
@@ -4744,7 +4750,8 @@ var NaviAdapter = class {
4744
4750
  const normalized = normalizeAsset(asset);
4745
4751
  const tx = await buildRepayTx(this.client, address, amount, {
4746
4752
  asset: normalized,
4747
- skipOracle: options?.skipOracle
4753
+ skipOracle: options?.skipOracle,
4754
+ skipPythUpdate: options?.skipPythUpdate
4748
4755
  });
4749
4756
  return { tx };
4750
4757
  }
@@ -4754,17 +4761,23 @@ var NaviAdapter = class {
4754
4761
  async maxBorrow(address, _asset) {
4755
4762
  return maxBorrowAmount(this.client, address);
4756
4763
  }
4757
- async addWithdrawToTx(tx, address, amount, asset) {
4764
+ async addWithdrawToTx(tx, address, amount, asset, options) {
4758
4765
  const normalized = normalizeAsset(asset);
4759
- return addWithdrawToTx(tx, this.client, address, amount, { asset: normalized });
4766
+ return addWithdrawToTx(tx, this.client, address, amount, {
4767
+ asset: normalized,
4768
+ skipPythUpdate: options?.skipPythUpdate
4769
+ });
4760
4770
  }
4761
4771
  async addSaveToTx(tx, address, coin, asset, options) {
4762
4772
  const normalized = normalizeAsset(asset);
4763
4773
  return addSaveToTx(tx, this.client, address, coin, { ...options, asset: normalized });
4764
4774
  }
4765
- async addRepayToTx(tx, address, coin, asset) {
4775
+ async addRepayToTx(tx, address, coin, asset, options) {
4766
4776
  const normalized = normalizeAsset(asset);
4767
- return addRepayToTx(tx, this.client, address, coin, { asset: normalized });
4777
+ return addRepayToTx(tx, this.client, address, coin, {
4778
+ asset: normalized,
4779
+ skipPythUpdate: options?.skipPythUpdate
4780
+ });
4768
4781
  }
4769
4782
  async getPendingRewards(address) {
4770
4783
  return getPendingRewards(this.client, address);