@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.
- 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 +7 -15
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +4 -9
- package/dist/adapters/index.d.ts +4 -9
- package/dist/adapters/index.js +7 -15
- 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-3YmGYl63.d.cts} +1 -6
- package/dist/{descriptors-DkKhitk_.d.ts → descriptors-3YmGYl63.d.ts} +1 -6
- package/dist/index.cjs +54 -434
- 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 +56 -431
- 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-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
|
|
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>;
|
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-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
|
|
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>;
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
4733
|
+
async buildWithdrawTx(address, amount, asset) {
|
|
4741
4734
|
const normalized = normalizeAsset(asset);
|
|
4742
|
-
const result = await buildWithdrawTx(this.client, address, amount, { asset: normalized
|
|
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 };
|