@t2000/sdk 0.23.0 → 0.27.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 +1 -0
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/index.cjs +27 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/{token-registry-DDy743E6.d.cts → token-registry-BYEXDwjs.d.cts} +1 -1
- package/dist/{token-registry-Bv1I9qeU.d.ts → token-registry-CX_RDDO_.d.ts} +1 -1
- package/dist/{types-DT-3gVTX.d.cts → types-D9NstGUu.d.cts} +13 -1
- package/dist/{types-DT-3gVTX.d.ts → types-D9NstGUu.d.ts} +13 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,6 +89,7 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
|
89
89
|
| `agent.address()` | Wallet Sui address | `string` |
|
|
90
90
|
| `agent.balance()` | Available USDC + savings + gas reserve | `BalanceResponse` |
|
|
91
91
|
| `agent.send({ to, amount, asset? })` | Transfer USDC to any Sui address | `SendResult` |
|
|
92
|
+
| `agent.receive({ amount?, currency?, memo?, label? })` | Generate payment request with QR URI | `PaymentRequest` |
|
|
92
93
|
| `agent.save({ amount, protocol? })` | Deposit **USDC** to savings (earn APY). Auto-selects best rate or specify `protocol`. `amount` can be `'all'`. | `SaveResult` |
|
|
93
94
|
| `agent.withdraw({ amount, asset? })` | Withdraw from savings. `amount` can be `'all'`. Optional `asset` for multi-asset withdrawals (default: USDC). | `WithdrawResult` |
|
|
94
95
|
| `agent.borrow({ amount })` | Borrow USDC against collateral | `BorrowResult` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, e as PendingReward } from '../descriptors-Be4FAgN5.cjs';
|
|
2
2
|
export { P as ProtocolDescriptor, d as allDescriptors, n as naviDescriptor } from '../descriptors-Be4FAgN5.cjs';
|
|
3
|
-
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-
|
|
3
|
+
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-D9NstGUu.cjs';
|
|
4
4
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, e as PendingReward } from '../descriptors-Be4FAgN5.js';
|
|
2
2
|
export { P as ProtocolDescriptor, d as allDescriptors, n as naviDescriptor } from '../descriptors-Be4FAgN5.js';
|
|
3
|
-
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-
|
|
3
|
+
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-D9NstGUu.js';
|
|
4
4
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, s as SupportedAsset, T as T2000Error, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, w as TransactionSigner, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, Z as ZkLoginProof, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ah as stableToRaw, ai as suiToMist, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-
|
|
2
|
-
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasMethod, b as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, c as MaxWithdrawResult, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, T as TransactionRecord, W as WithdrawResult } from './types-
|
|
1
|
+
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, s as SupportedAsset, T as T2000Error, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, w as TransactionSigner, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, Z as ZkLoginProof, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ah as stableToRaw, ai as suiToMist, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-BYEXDwjs.cjs';
|
|
2
|
+
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasMethod, b as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, c as MaxWithdrawResult, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, T as TransactionRecord, W as WithdrawResult } from './types-D9NstGUu.cjs';
|
|
3
3
|
import '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import '@mysten/sui/jsonRpc';
|
|
5
5
|
import '@mysten/sui/transactions';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, s as SupportedAsset, T as T2000Error, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, w as TransactionSigner, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, Z as ZkLoginProof, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ah as stableToRaw, ai as suiToMist, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-
|
|
2
|
-
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasMethod, b as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, c as MaxWithdrawResult, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, T as TransactionRecord, W as WithdrawResult } from './types-
|
|
1
|
+
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, s as SupportedAsset, T as T2000Error, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, w as TransactionSigner, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, Z as ZkLoginProof, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ah as stableToRaw, ai as suiToMist, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-CX_RDDO_.js';
|
|
2
|
+
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasMethod, b as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, c as MaxWithdrawResult, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, T as TransactionRecord, W as WithdrawResult } from './types-D9NstGUu.js';
|
|
3
3
|
import '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import '@mysten/sui/jsonRpc';
|
|
5
5
|
import '@mysten/sui/transactions';
|
package/dist/index.cjs
CHANGED
|
@@ -903,7 +903,7 @@ function extractCommands(txBlock) {
|
|
|
903
903
|
if (!data || typeof data !== "object") return result;
|
|
904
904
|
const inner = "transaction" in data ? data.transaction : void 0;
|
|
905
905
|
if (!inner || typeof inner !== "object") return result;
|
|
906
|
-
const commands = "commands" in inner ? inner.commands : void 0;
|
|
906
|
+
const commands = "commands" in inner ? inner.commands : "transactions" in inner ? inner.transactions : void 0;
|
|
907
907
|
if (!Array.isArray(commands)) return result;
|
|
908
908
|
for (const cmd of commands) {
|
|
909
909
|
if (cmd.MoveCall) {
|
|
@@ -2629,6 +2629,32 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
2629
2629
|
].join("\n")
|
|
2630
2630
|
};
|
|
2631
2631
|
}
|
|
2632
|
+
receive(params) {
|
|
2633
|
+
const amount = params?.amount ?? null;
|
|
2634
|
+
const currency = params?.currency ?? "USDC";
|
|
2635
|
+
const memo = params?.memo ?? null;
|
|
2636
|
+
const label = params?.label ?? null;
|
|
2637
|
+
const qrParts = [`sui:${this._address}`];
|
|
2638
|
+
const queryParams = [];
|
|
2639
|
+
if (amount != null) queryParams.push(`amount=${amount}`);
|
|
2640
|
+
if (currency !== "SUI") queryParams.push(`currency=${currency}`);
|
|
2641
|
+
if (memo) queryParams.push(`memo=${encodeURIComponent(memo)}`);
|
|
2642
|
+
if (label) queryParams.push(`label=${encodeURIComponent(label)}`);
|
|
2643
|
+
const qrUri = queryParams.length > 0 ? `${qrParts[0]}?${queryParams.join("&")}` : qrParts[0];
|
|
2644
|
+
const amountStr = amount != null ? `$${amount.toFixed(2)} ` : "";
|
|
2645
|
+
const displayParts = [`Send ${amountStr}${currency} to ${truncateAddress(this._address)}`];
|
|
2646
|
+
if (memo) displayParts.push(`Memo: ${memo}`);
|
|
2647
|
+
return {
|
|
2648
|
+
address: this._address,
|
|
2649
|
+
network: "mainnet",
|
|
2650
|
+
amount,
|
|
2651
|
+
currency,
|
|
2652
|
+
memo,
|
|
2653
|
+
label,
|
|
2654
|
+
qrUri,
|
|
2655
|
+
displayText: displayParts.join("\n")
|
|
2656
|
+
};
|
|
2657
|
+
}
|
|
2632
2658
|
exportKey() {
|
|
2633
2659
|
return exportPrivateKey(this.keypair);
|
|
2634
2660
|
}
|