@t2000/sdk 0.56.2 → 1.0.0

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,6 +1,6 @@
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-DkKhitk_.cjs';
2
- export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DkKhitk_.cjs';
3
- import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-DVVns7_w.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-3YmGYl63.cjs';
2
+ export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-3YmGYl63.cjs';
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';
6
6
 
@@ -57,19 +57,14 @@ declare class NaviAdapter implements LendingAdapter {
57
57
  getHealth(address: string): Promise<HealthInfo>;
58
58
  buildSaveTx(address: string, amount: number, asset: string, options?: {
59
59
  collectFee?: boolean;
60
- sponsored?: boolean;
61
60
  }): Promise<AdapterTxResult>;
62
- buildWithdrawTx(address: string, amount: number, asset: string, options?: {
63
- sponsored?: boolean;
64
- }): Promise<AdapterTxResult & {
61
+ buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
65
62
  effectiveAmount: number;
66
63
  }>;
67
64
  buildBorrowTx(address: string, amount: number, asset: string, options?: {
68
65
  collectFee?: boolean;
69
- sponsored?: boolean;
70
66
  }): Promise<AdapterTxResult>;
71
67
  buildRepayTx(address: string, amount: number, asset: string, options?: {
72
- sponsored?: boolean;
73
68
  skipOracle?: boolean;
74
69
  }): Promise<AdapterTxResult>;
75
70
  maxWithdraw(address: string, _asset: string): Promise<MaxWithdrawResult>;
@@ -1,6 +1,6 @@
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-DkKhitk_.js';
2
- export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DkKhitk_.js';
3
- import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-DVVns7_w.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-3YmGYl63.js';
2
+ export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-3YmGYl63.js';
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';
6
6
 
@@ -57,19 +57,14 @@ declare class NaviAdapter implements LendingAdapter {
57
57
  getHealth(address: string): Promise<HealthInfo>;
58
58
  buildSaveTx(address: string, amount: number, asset: string, options?: {
59
59
  collectFee?: boolean;
60
- sponsored?: boolean;
61
60
  }): Promise<AdapterTxResult>;
62
- buildWithdrawTx(address: string, amount: number, asset: string, options?: {
63
- sponsored?: boolean;
64
- }): Promise<AdapterTxResult & {
61
+ buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
65
62
  effectiveAmount: number;
66
63
  }>;
67
64
  buildBorrowTx(address: string, amount: number, asset: string, options?: {
68
65
  collectFee?: boolean;
69
- sponsored?: boolean;
70
66
  }): Promise<AdapterTxResult>;
71
67
  buildRepayTx(address: string, amount: number, asset: string, options?: {
72
- sponsored?: boolean;
73
68
  skipOracle?: boolean;
74
69
  }): Promise<AdapterTxResult>;
75
70
  maxWithdraw(address: string, _asset: string): Promise<MaxWithdrawResult>;
@@ -4275,8 +4275,6 @@ async function refreshOracle(tx, client, address, options) {
4275
4275
  const oracleOpts = {
4276
4276
  ...sdkOptions(client),
4277
4277
  throws: false,
4278
- // Pyth update uses tx.splitCoins(tx.gas, ...) which is incompatible
4279
- // with sponsored transactions where tx.gas belongs to the sponsor.
4280
4278
  updatePythPriceFeeds: !options?.skipPythUpdate
4281
4279
  };
4282
4280
  await mt(tx, address, pools, oracleOpts);
@@ -4467,7 +4465,7 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
4467
4465
  }
4468
4466
  const tx = new Transaction();
4469
4467
  tx.setSender(address);
4470
- await refreshOracle(tx, client, address, { skipPythUpdate: options.sponsored });
4468
+ await refreshOracle(tx, client, address);
4471
4469
  try {
4472
4470
  const coin = await Qe(tx, assetInfo.type, rawAmount, sdkOptions(client));
4473
4471
  tx.transferObjects([coin], address);
@@ -4479,7 +4477,6 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
4479
4477
  }
4480
4478
  async function addWithdrawToTx(tx, client, address, amount, options = {}) {
4481
4479
  const asset = options.asset ?? "USDC";
4482
- const sponsored = options.sponsored ?? true;
4483
4480
  const assetInfo = resolveAssetInfo(asset);
4484
4481
  const posResult = await getPositions(client, address);
4485
4482
  const supply = posResult.positions.find(
@@ -4497,7 +4494,7 @@ async function addWithdrawToTx(tx, client, address, amount, options = {}) {
4497
4494
  });
4498
4495
  return { coin, effectiveAmount: 0 };
4499
4496
  }
4500
- await refreshOracle(tx, client, address, { skipPythUpdate: sponsored });
4497
+ await refreshOracle(tx, client, address);
4501
4498
  try {
4502
4499
  const coin = await Qe(tx, assetInfo.type, rawAmount, sdkOptions(client));
4503
4500
  return { coin, effectiveAmount };
@@ -4521,9 +4518,8 @@ async function addSaveToTx(tx, _client, _address, coin, options = {}) {
4521
4518
  }
4522
4519
  async function addRepayToTx(tx, client, address, coin, options = {}) {
4523
4520
  const asset = options.asset ?? "USDC";
4524
- const sponsored = options.sponsored ?? true;
4525
4521
  const assetInfo = resolveAssetInfo(asset);
4526
- await refreshOracle(tx, client, address, { skipPythUpdate: sponsored });
4522
+ await refreshOracle(tx, client, address);
4527
4523
  try {
4528
4524
  await xe(tx, assetInfo.type, coin, { env: "prod" });
4529
4525
  } catch (err) {
@@ -4540,7 +4536,7 @@ async function buildBorrowTx(client, address, amount, options = {}) {
4540
4536
  const rawAmount = Number(stableToRaw(amount, assetInfo.decimals));
4541
4537
  const tx = new Transaction();
4542
4538
  tx.setSender(address);
4543
- await refreshOracle(tx, client, address, { skipPythUpdate: options.sponsored });
4539
+ await refreshOracle(tx, client, address);
4544
4540
  try {
4545
4541
  const borrowedCoin = await Xe(tx, assetInfo.type, rawAmount, sdkOptions(client));
4546
4542
  if (options.collectFee) {
@@ -4571,10 +4567,7 @@ async function buildRepayTx(client, address, amount, options = {}) {
4571
4567
  const coinObj = mergeCoins(tx, coins);
4572
4568
  const rawAmount = Math.min(rawRequested, Number(totalBalance));
4573
4569
  const [repayCoin] = tx.splitCoins(coinObj, [rawAmount]);
4574
- await refreshOracle(tx, client, address, {
4575
- skipPythUpdate: options.sponsored,
4576
- skipOracle: options.skipOracle
4577
- });
4570
+ await refreshOracle(tx, client, address, { skipOracle: options.skipOracle });
4578
4571
  try {
4579
4572
  await xe(tx, assetInfo.type, repayCoin, {
4580
4573
  ...sdkOptions(client),
@@ -4737,9 +4730,9 @@ var NaviAdapter = class {
4737
4730
  const tx = await buildSaveTx(this.client, address, amount, { ...options, asset: normalized });
4738
4731
  return { tx };
4739
4732
  }
4740
- async buildWithdrawTx(address, amount, asset, options) {
4733
+ async buildWithdrawTx(address, amount, asset) {
4741
4734
  const normalized = normalizeAsset(asset);
4742
- const result = await buildWithdrawTx(this.client, address, amount, { asset: normalized, sponsored: options?.sponsored });
4735
+ const result = await buildWithdrawTx(this.client, address, amount, { asset: normalized });
4743
4736
  return { tx: result.tx, effectiveAmount: result.effectiveAmount };
4744
4737
  }
4745
4738
  async buildBorrowTx(address, amount, asset, options) {
@@ -4751,7 +4744,6 @@ var NaviAdapter = class {
4751
4744
  const normalized = normalizeAsset(asset);
4752
4745
  const tx = await buildRepayTx(this.client, address, amount, {
4753
4746
  asset: normalized,
4754
- sponsored: options?.sponsored,
4755
4747
  skipOracle: options?.skipOracle
4756
4748
  });
4757
4749
  return { tx };