@t2000/cli 0.22.18 → 0.22.21

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 CHANGED
@@ -32,7 +32,7 @@ t2000 init
32
32
  ✓ Keypair generated
33
33
  ✓ Network Sui mainnet
34
34
  ✓ Gas sponsorship enabled
35
- ✓ Checking ✓ Savings ✓ Credit ✓ Trade
35
+ ✓ Checking ✓ Savings ✓ Credit ✓ Swap ✓ Investment
36
36
 
37
37
  🎉 Bank account created
38
38
  Address: 0x8b3e...d412
@@ -115,7 +115,7 @@ t2000 init
115
115
  Tx: https://suiscan.xyz/mainnet/tx/...
116
116
 
117
117
  ❯ t2000 portfolio
118
- Trade Portfolio
118
+ Investment Portfolio
119
119
  ─────────────────────────────────────────────────────
120
120
  SUI 105.26000000 Avg: $0.95 Now: $0.97 APY: 2.10% +$2.10 (+2.1%)
121
121
  BTC 0.00512820 Avg: $97,500 Now: $98,200 — +$3.59 (+0.7%)
@@ -241,7 +241,7 @@ t2000 init
241
241
  | `t2000 contacts add <name> <address>` | Save a named contact |
242
242
  | `t2000 contacts remove <name>` | Remove a contact |
243
243
 
244
- ### Trade
244
+ ### Invest
245
245
 
246
246
  | Command | Description |
247
247
  |---------|-------------|
@@ -251,7 +251,7 @@ t2000 init
251
251
  | `t2000 invest earn <asset>` | Deposit held asset into best-rate lending for yield |
252
252
  | `t2000 invest unearn <asset>` | Withdraw from lending, keep in portfolio |
253
253
  | `t2000 invest rebalance` | Move earning positions to better-rate protocols |
254
- | `t2000 portfolio` | View trade portfolio with cost-basis P&L (strategy grouping) |
254
+ | `t2000 portfolio` | View investment portfolio with cost-basis P&L (strategy grouping) |
255
255
 
256
256
  > **Deprecated:** `t2000 exchange` still works but prints a deprecation notice — use `t2000 swap`. `t2000 invest buy` / `t2000 invest sell` still work but are deprecated — use `t2000 buy` / `t2000 sell`.
257
257
 
@@ -67295,6 +67295,34 @@ var T2000 = class _T2000 extends import_index.default {
67295
67295
  const priceImpact = expectedOutput > 0 ? Math.abs(actualReceived - expectedOutput) / expectedOutput : 0;
67296
67296
  reportFee(this._address, "swap", fee.amount, fee.rate, gasResult.digest);
67297
67297
  this.emitBalanceChange(fromAsset, swapAmount, "swap", gasResult.digest);
67298
+ const stableSet = new Set(STABLE_ASSETS);
67299
+ if (!params._skipPortfolioRecord && stableSet.has(fromAsset) && toAsset in INVESTMENT_ASSETS && actualReceived > 0) {
67300
+ const price = swapAmount / actualReceived;
67301
+ this.portfolio.recordBuy({
67302
+ id: `swap_${Date.now()}`,
67303
+ type: "buy",
67304
+ asset: toAsset,
67305
+ amount: actualReceived,
67306
+ price,
67307
+ usdValue: swapAmount,
67308
+ fee: fee.amount,
67309
+ tx: gasResult.digest,
67310
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
67311
+ });
67312
+ } else if (!params._skipPortfolioRecord && fromAsset in INVESTMENT_ASSETS && stableSet.has(toAsset) && actualReceived > 0) {
67313
+ const price = actualReceived / swapAmount;
67314
+ this.portfolio.recordSell({
67315
+ id: `swap_${Date.now()}`,
67316
+ type: "sell",
67317
+ asset: fromAsset,
67318
+ amount: swapAmount,
67319
+ price,
67320
+ usdValue: actualReceived,
67321
+ fee: fee.amount,
67322
+ tx: gasResult.digest,
67323
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
67324
+ });
67325
+ }
67298
67326
  return {
67299
67327
  success: true,
67300
67328
  tx: gasResult.digest,
@@ -67352,7 +67380,8 @@ var T2000 = class _T2000 extends import_index.default {
67352
67380
  from: "USDC",
67353
67381
  to: params.asset,
67354
67382
  amount: params.usdAmount,
67355
- maxSlippage: params.maxSlippage ?? defaultSlippage(params.asset)
67383
+ maxSlippage: params.maxSlippage ?? defaultSlippage(params.asset),
67384
+ _skipPortfolioRecord: true
67356
67385
  });
67357
67386
  break;
67358
67387
  } catch (err) {
@@ -67472,7 +67501,8 @@ var T2000 = class _T2000 extends import_index.default {
67472
67501
  from: params.asset,
67473
67502
  to: "USDC",
67474
67503
  amount: sellAmountAsset,
67475
- maxSlippage: params.maxSlippage ?? defaultSlippage(params.asset)
67504
+ maxSlippage: params.maxSlippage ?? defaultSlippage(params.asset),
67505
+ _skipPortfolioRecord: true
67476
67506
  });
67477
67507
  break;
67478
67508
  } catch (err) {
@@ -69077,4 +69107,4 @@ lodash/lodash.js:
69077
69107
  @scure/bip39/index.js:
69078
69108
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
69079
69109
  */
69080
- //# sourceMappingURL=chunk-4FTMWFBO.js.map
69110
+ //# sourceMappingURL=chunk-ZNF5QSAT.js.map