@t2000/sdk 0.14.0 → 0.14.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 CHANGED
@@ -56,6 +56,8 @@ await agent.withdraw({ amount: 25 });
56
56
 
57
57
  // Invest in crypto assets
58
58
  await agent.investBuy({ asset: 'SUI', usdAmount: 100 });
59
+ await agent.investBuy({ asset: 'BTC', usdAmount: 500 });
60
+ await agent.investBuy({ asset: 'ETH', usdAmount: 200 });
59
61
 
60
62
  // Check portfolio
61
63
  const portfolio = await agent.getPortfolio();
@@ -246,6 +248,7 @@ import {
246
248
  rawToUsdc,
247
249
  formatUsd,
248
250
  formatSui,
251
+ formatAssetAmount,
249
252
  validateAddress,
250
253
  truncateAddress,
251
254
  } from '@t2000/sdk';
@@ -255,6 +258,11 @@ usdcToRaw(10.50); // 10_500_000n
255
258
  formatUsd(1234.5); // "$1234.50"
256
259
  truncateAddress('0xabcdef...1234'); // "0xabcd...1234"
257
260
  validateAddress('0x...'); // throws if invalid
261
+
262
+ // Asset-aware decimal formatting
263
+ formatAssetAmount('BTC', 0.00123456); // "0.00123456" (8 decimals)
264
+ formatAssetAmount('ETH', 1.5); // "1.50000000" (8 decimals)
265
+ formatAssetAmount('SUI', 105.26); // "105.260000000" (9 decimals)
258
266
  ```
259
267
 
260
268
  ### Advanced: Exposed Internals