@t2000/sdk 0.56.2 → 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.
- package/README.md +8 -25
- package/dist/adapters/descriptors.d.cts +1 -1
- package/dist/adapters/descriptors.d.ts +1 -1
- package/dist/adapters/index.cjs +22 -17
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +12 -9
- package/dist/adapters/index.d.ts +12 -9
- package/dist/adapters/index.js +22 -17
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs +14 -335
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +15 -332
- package/dist/browser.js.map +1 -1
- package/dist/{descriptors-DkKhitk_.d.cts → descriptors-CDVXo3BM.d.cts} +9 -6
- package/dist/{descriptors-DkKhitk_.d.ts → descriptors-CDVXo3BM.d.ts} +9 -6
- package/dist/index.cjs +69 -436
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -20
- package/dist/index.d.ts +24 -20
- package/dist/index.js +71 -433
- package/dist/index.js.map +1 -1
- package/dist/{token-registry-BortlMRr.d.ts → token-registry-CoTPqCbS.d.ts} +19 -84
- package/dist/{token-registry-DWRdYf6m.d.cts → token-registry-DAHghHh2.d.cts} +19 -84
- package/dist/{types-DVVns7_w.d.cts → types-jAD-e7Pq.d.cts} +1 -14
- package/dist/{types-DVVns7_w.d.ts → types-jAD-e7Pq.d.ts} +1 -14
- package/package.json +1 -1
|
@@ -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-
|
|
2
|
-
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-
|
|
3
|
-
import {
|
|
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
|
+
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,31 +57,34 @@ 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
61
|
buildWithdrawTx(address: string, amount: number, asset: string, options?: {
|
|
63
|
-
|
|
62
|
+
skipPythUpdate?: boolean;
|
|
64
63
|
}): Promise<AdapterTxResult & {
|
|
65
64
|
effectiveAmount: number;
|
|
66
65
|
}>;
|
|
67
66
|
buildBorrowTx(address: string, amount: number, asset: string, options?: {
|
|
68
67
|
collectFee?: boolean;
|
|
69
|
-
|
|
68
|
+
skipPythUpdate?: boolean;
|
|
70
69
|
}): Promise<AdapterTxResult>;
|
|
71
70
|
buildRepayTx(address: string, amount: number, asset: string, options?: {
|
|
72
|
-
sponsored?: boolean;
|
|
73
71
|
skipOracle?: boolean;
|
|
72
|
+
skipPythUpdate?: boolean;
|
|
74
73
|
}): Promise<AdapterTxResult>;
|
|
75
74
|
maxWithdraw(address: string, _asset: string): Promise<MaxWithdrawResult>;
|
|
76
75
|
maxBorrow(address: string, _asset: string): Promise<MaxBorrowResult>;
|
|
77
|
-
addWithdrawToTx(tx: Transaction, address: string, amount: number, asset: string
|
|
76
|
+
addWithdrawToTx(tx: Transaction, address: string, amount: number, asset: string, options?: {
|
|
77
|
+
skipPythUpdate?: boolean;
|
|
78
|
+
}): Promise<{
|
|
78
79
|
coin: TransactionObjectArgument;
|
|
79
80
|
effectiveAmount: number;
|
|
80
81
|
}>;
|
|
81
82
|
addSaveToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
|
|
82
83
|
collectFee?: boolean;
|
|
83
84
|
}): Promise<void>;
|
|
84
|
-
addRepayToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string
|
|
85
|
+
addRepayToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
|
|
86
|
+
skipPythUpdate?: boolean;
|
|
87
|
+
}): Promise<void>;
|
|
85
88
|
getPendingRewards(address: string): Promise<PendingReward[]>;
|
|
86
89
|
addClaimRewardsToTx(tx: Transaction, address: string): Promise<PendingReward[]>;
|
|
87
90
|
}
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -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-
|
|
2
|
-
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-
|
|
3
|
-
import {
|
|
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
|
+
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,31 +57,34 @@ 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
61
|
buildWithdrawTx(address: string, amount: number, asset: string, options?: {
|
|
63
|
-
|
|
62
|
+
skipPythUpdate?: boolean;
|
|
64
63
|
}): Promise<AdapterTxResult & {
|
|
65
64
|
effectiveAmount: number;
|
|
66
65
|
}>;
|
|
67
66
|
buildBorrowTx(address: string, amount: number, asset: string, options?: {
|
|
68
67
|
collectFee?: boolean;
|
|
69
|
-
|
|
68
|
+
skipPythUpdate?: boolean;
|
|
70
69
|
}): Promise<AdapterTxResult>;
|
|
71
70
|
buildRepayTx(address: string, amount: number, asset: string, options?: {
|
|
72
|
-
sponsored?: boolean;
|
|
73
71
|
skipOracle?: boolean;
|
|
72
|
+
skipPythUpdate?: boolean;
|
|
74
73
|
}): Promise<AdapterTxResult>;
|
|
75
74
|
maxWithdraw(address: string, _asset: string): Promise<MaxWithdrawResult>;
|
|
76
75
|
maxBorrow(address: string, _asset: string): Promise<MaxBorrowResult>;
|
|
77
|
-
addWithdrawToTx(tx: Transaction, address: string, amount: number, asset: string
|
|
76
|
+
addWithdrawToTx(tx: Transaction, address: string, amount: number, asset: string, options?: {
|
|
77
|
+
skipPythUpdate?: boolean;
|
|
78
|
+
}): Promise<{
|
|
78
79
|
coin: TransactionObjectArgument;
|
|
79
80
|
effectiveAmount: number;
|
|
80
81
|
}>;
|
|
81
82
|
addSaveToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
|
|
82
83
|
collectFee?: boolean;
|
|
83
84
|
}): Promise<void>;
|
|
84
|
-
addRepayToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string
|
|
85
|
+
addRepayToTx(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
|
|
86
|
+
skipPythUpdate?: boolean;
|
|
87
|
+
}): Promise<void>;
|
|
85
88
|
getPendingRewards(address: string): Promise<PendingReward[]>;
|
|
86
89
|
addClaimRewardsToTx(tx: Transaction, address: string): Promise<PendingReward[]>;
|
|
87
90
|
}
|
package/dist/adapters/index.js
CHANGED
|
@@ -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.
|
|
4468
|
+
await refreshOracle(tx, client, address, { skipPythUpdate: options.skipPythUpdate });
|
|
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:
|
|
4497
|
+
await refreshOracle(tx, client, address, { skipPythUpdate: options.skipPythUpdate });
|
|
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:
|
|
4522
|
+
await refreshOracle(tx, client, address, { skipPythUpdate: options.skipPythUpdate });
|
|
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.
|
|
4539
|
+
await refreshOracle(tx, client, address, { skipPythUpdate: options.skipPythUpdate });
|
|
4544
4540
|
try {
|
|
4545
4541
|
const borrowedCoin = await Xe(tx, assetInfo.type, rawAmount, sdkOptions(client));
|
|
4546
4542
|
if (options.collectFee) {
|
|
@@ -4572,8 +4568,8 @@ async function buildRepayTx(client, address, amount, options = {}) {
|
|
|
4572
4568
|
const rawAmount = Math.min(rawRequested, Number(totalBalance));
|
|
4573
4569
|
const [repayCoin] = tx.splitCoins(coinObj, [rawAmount]);
|
|
4574
4570
|
await refreshOracle(tx, client, address, {
|
|
4575
|
-
|
|
4576
|
-
|
|
4571
|
+
skipOracle: options.skipOracle,
|
|
4572
|
+
skipPythUpdate: options.skipPythUpdate
|
|
4577
4573
|
});
|
|
4578
4574
|
try {
|
|
4579
4575
|
await xe(tx, assetInfo.type, repayCoin, {
|
|
@@ -4739,7 +4735,10 @@ var NaviAdapter = class {
|
|
|
4739
4735
|
}
|
|
4740
4736
|
async buildWithdrawTx(address, amount, asset, options) {
|
|
4741
4737
|
const normalized = normalizeAsset(asset);
|
|
4742
|
-
const result = await buildWithdrawTx(this.client, address, amount, {
|
|
4738
|
+
const result = await buildWithdrawTx(this.client, address, amount, {
|
|
4739
|
+
asset: normalized,
|
|
4740
|
+
skipPythUpdate: options?.skipPythUpdate
|
|
4741
|
+
});
|
|
4743
4742
|
return { tx: result.tx, effectiveAmount: result.effectiveAmount };
|
|
4744
4743
|
}
|
|
4745
4744
|
async buildBorrowTx(address, amount, asset, options) {
|
|
@@ -4751,8 +4750,8 @@ var NaviAdapter = class {
|
|
|
4751
4750
|
const normalized = normalizeAsset(asset);
|
|
4752
4751
|
const tx = await buildRepayTx(this.client, address, amount, {
|
|
4753
4752
|
asset: normalized,
|
|
4754
|
-
|
|
4755
|
-
|
|
4753
|
+
skipOracle: options?.skipOracle,
|
|
4754
|
+
skipPythUpdate: options?.skipPythUpdate
|
|
4756
4755
|
});
|
|
4757
4756
|
return { tx };
|
|
4758
4757
|
}
|
|
@@ -4762,17 +4761,23 @@ var NaviAdapter = class {
|
|
|
4762
4761
|
async maxBorrow(address, _asset) {
|
|
4763
4762
|
return maxBorrowAmount(this.client, address);
|
|
4764
4763
|
}
|
|
4765
|
-
async addWithdrawToTx(tx, address, amount, asset) {
|
|
4764
|
+
async addWithdrawToTx(tx, address, amount, asset, options) {
|
|
4766
4765
|
const normalized = normalizeAsset(asset);
|
|
4767
|
-
return addWithdrawToTx(tx, this.client, address, amount, {
|
|
4766
|
+
return addWithdrawToTx(tx, this.client, address, amount, {
|
|
4767
|
+
asset: normalized,
|
|
4768
|
+
skipPythUpdate: options?.skipPythUpdate
|
|
4769
|
+
});
|
|
4768
4770
|
}
|
|
4769
4771
|
async addSaveToTx(tx, address, coin, asset, options) {
|
|
4770
4772
|
const normalized = normalizeAsset(asset);
|
|
4771
4773
|
return addSaveToTx(tx, this.client, address, coin, { ...options, asset: normalized });
|
|
4772
4774
|
}
|
|
4773
|
-
async addRepayToTx(tx, address, coin, asset) {
|
|
4775
|
+
async addRepayToTx(tx, address, coin, asset, options) {
|
|
4774
4776
|
const normalized = normalizeAsset(asset);
|
|
4775
|
-
return addRepayToTx(tx, this.client, address, coin, {
|
|
4777
|
+
return addRepayToTx(tx, this.client, address, coin, {
|
|
4778
|
+
asset: normalized,
|
|
4779
|
+
skipPythUpdate: options?.skipPythUpdate
|
|
4780
|
+
});
|
|
4776
4781
|
}
|
|
4777
4782
|
async getPendingRewards(address) {
|
|
4778
4783
|
return getPendingRewards(this.client, address);
|