@t2000/sdk 5.5.0 → 5.6.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/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { SuiGrpcClient } from '@mysten/sui/grpc';
3
3
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
- import { T as T2000Error, at as T2000Options, F as TransactionSigner, P as PayOptions, k as PayResult, au as SwapResult, av as SwapQuoteResult, t as SupportedAsset, o as SendResult, B as BalanceResponse, A as TransactionRecord, e as DepositInfo, aw as PaymentRequest, Z as ZkLoginProof, ax as SuiCoreClient, ay as SendableAsset, j as OverlayFeeConfig, az as SponsoredCoinMergeCache, u as SwapRouteResult } from './simulate-KETPmlDo.cjs';
5
- export { aA as CETUS_USDC_SUI_POOL, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, aB as CoinPage, aC as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, E as ETH_TYPE, f as ExtractedTransfer, aD as GASLESS_MIN_STABLE_AMOUNT, aE as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, aF as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, aG as Operation, aH as SENDABLE_ASSETS, S as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, aI as SelectAndSplitResult, aJ as SerializedCetusRoute, aK as SerializedCetusRoutePath, aL as SerializedRouterDataV3, p as SimulationResult, q as StableAsset, r as SuiHolding, s as SuiRpcTxBlock, v as T2000ErrorCode, w as T2000ErrorData, x as T2000_OVERLAY_FEE_WALLET, y as TOKEN_MAP, z as TransactionLeg, H as TxDirection, U as USDC_DECIMALS, J as USDC_TYPE, Q as USDE_TYPE, R as USDSUI_TYPE, V as USDT_TYPE, W as WAL_TYPE, X as WBTC_TYPE, Y as ZkLoginSigner, aM as addSwapToTx, aN as assertAllowedAsset, _ as buildSwapTx, $ as classifyAction, a0 as classifyLabel, a1 as classifyTransaction, aO as deserializeCetusRoute, a2 as executeTx, a3 as extractAllUserLegs, a4 as extractTransferDetails, a5 as extractTxCommands, a6 as extractTxSender, a7 as fallbackLabel, aP as fetchAllCoins, a8 as findSwapRoute, a9 as formatAssetAmount, aa as formatSui, ab as formatUsd, aQ as getCoinMeta, ac as getDecimals, ad as getDecimalsForCoinType, aR as getSuiClient, aS as getSuiGrpcClient, aT as isAllowedAsset, aU as isCetusRouteFresh, aV as isInRegistry, ae as mapMoveAbortCode, af as mapWalletError, ag as mistToSui, aW as normalizeAsset, aX as normalizeCoinType, ah as parseSuiRpcTx, ai as payWithMpp, aY as queryHistory, aZ as queryTransaction, aj as rawToStable, ak as rawToUsdc, al as refineLendingLabel, am as resolveSymbol, an as resolveTokenType, a_ as selectAndSplitCoin, a$ as selectSuiCoin, b0 as serializeCetusRoute, b1 as simulateTransaction, ao as stableToRaw, ap as suiToMist, b2 as throwIfSimulationFailed, aq as truncateAddress, ar as usdcToRaw, as as validateAddress, b3 as verifyCetusRouteCoinMatch } from './simulate-KETPmlDo.cjs';
6
- import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
4
+ import { T as T2000Error, aD as T2000Options, Q as TransactionSigner, l as PayOptions, m as PayResult, aE as SwapResult, aF as SwapQuoteResult, w as SupportedAsset, r as SendResult, B as BalanceResponse, J as TransactionRecord, e as DepositInfo, aG as PaymentRequest, $ as ZkLoginProof, aH as SuiCoreClient, j as OverlayFeeConfig, aI as SponsoredCoinMergeCache, x as SwapRouteResult, aJ as SendableAsset } from './send-D2nKpwJN.cjs';
5
+ export { aK as CETUS_USDC_SUI_POOL, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, aL as CoinPage, aM as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, E as ETH_TYPE, f as ExtractedTransfer, aN as GASLESS_MIN_STABLE_AMOUNT, aO as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, aP as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, aQ as Operation, P as PREFLIGHT_MAX_AMOUNT, k as PREFLIGHT_OK, n as PreflightResult, aR as SENDABLE_ASSETS, S as STABLE_ASSETS, o as SUI_DECIMALS, p as SUI_TYPE, q as SUPPORTED_ASSETS, aS as SelectAndSplitResult, aT as SerializedCetusRoute, aU as SerializedCetusRoutePath, aV as SerializedRouterDataV3, s as SimulationResult, t as StableAsset, u as SuiHolding, v as SuiRpcTxBlock, y as T2000ErrorCode, z as T2000ErrorData, A as T2000_OVERLAY_FEE_WALLET, F as TOKEN_MAP, H as TransactionLeg, R as TxDirection, U as USDC_DECIMALS, V as USDC_TYPE, W as USDE_TYPE, X as USDSUI_TYPE, Y as USDT_TYPE, Z as WAL_TYPE, _ as WBTC_TYPE, a0 as ZkLoginSigner, aW as addSendToTx, aX as addSwapToTx, aY as assertAllowedAsset, a1 as buildSendTx, a2 as buildSwapTx, a3 as checkPositiveAmount, a4 as checkSuiAddress, a5 as classifyAction, a6 as classifyLabel, a7 as classifyTransaction, aZ as deserializeCetusRoute, a8 as executeTx, a9 as extractAllUserLegs, aa as extractTransferDetails, ab as extractTxCommands, ac as extractTxSender, ad as fallbackLabel, a_ as fetchAllCoins, ae as findSwapRoute, af as formatAssetAmount, ag as formatSui, ah as formatUsd, a$ as getCoinMeta, ai as getDecimals, aj as getDecimalsForCoinType, b0 as getSuiClient, b1 as getSuiGrpcClient, b2 as isAllowedAsset, b3 as isCetusRouteFresh, b4 as isInRegistry, ak as mapMoveAbortCode, al as mapWalletError, am as mistToSui, b5 as normalizeAsset, b6 as normalizeCoinType, an as parseSuiRpcTx, ao as payWithMpp, ap as preflightFail, aq as preflightPay, ar as preflightSend, as as preflightSwap, b7 as queryHistory, b8 as queryTransaction, at as rawToStable, au as rawToUsdc, av as refineLendingLabel, aw as resolveSymbol, ax as resolveTokenType, b9 as selectAndSplitCoin, ba as selectSuiCoin, bb as serializeCetusRoute, bc as simulateTransaction, ay as stableToRaw, az as suiToMist, bd as throwIfSimulationFailed, aA as truncateAddress, aB as usdcToRaw, aC as validateAddress, be as verifyCetusRouteCoinMatch } from './send-D2nKpwJN.cjs';
6
+ import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
7
7
  import { SuinsClient } from '@mysten/suins';
8
8
  import '@mysten/sui/client';
9
9
  import '@cetusprotocol/aggregator-sdk';
@@ -303,31 +303,35 @@ declare class SuinsRpcError extends Error {
303
303
  */
304
304
  declare function looksLikeSuiNs(value: string): boolean;
305
305
  /**
306
- * Resolve a SuiNS name to its on-chain Sui address via the public
307
- * `suix_resolveNameServiceAddress` JSON-RPC method. Returns `null` if
308
- * the name resolves to no address (= not registered or expired). Throws
309
- * `SuinsRpcError` on RPC/network failure.
306
+ * Resolve a SuiNS name to its on-chain Sui address via the Sui GraphQL
307
+ * `address(name:)` query. Returns `null` if the name resolves to no address
308
+ * (= not registered or expired). Throws `SuinsRpcError` on transport failure.
310
309
  *
311
- * The host SHOULD pass a `rpcUrl` that includes any vendor key (e.g.
312
- * audric's BlockVision-keyed URL) so the call benefits from the host's
313
- * paid retry/cache budget. Falls back to the public mainnet endpoint.
310
+ * `ctx.signal` is honored for cancellation. (`ctx.suiRpcUrl` is retained for
311
+ * call-site back-compat but no longer used resolution runs against the
312
+ * canonical GraphQL endpoint via `getSuiGraphQLClient()`.)
314
313
  */
315
314
  declare function resolveSuinsViaRpc(rawName: string, ctx?: {
316
315
  suiRpcUrl?: string;
317
316
  signal?: AbortSignal;
318
317
  }): Promise<string | null>;
319
318
  /**
320
- * Reverse-resolve a 0x address to its registered SuiNS names via
321
- * `suix_resolveNameServiceNames`. Returns the names sorted by the
322
- * registry (the first entry is conventionally the user's "primary"
323
- * name on dApps that show one), or `[]` when the address has no
324
- * SuiNS records. Throws `SuinsRpcError` on RPC/network failure.
319
+ * Reverse-resolve a 0x address to its SuiNS name via the Sui GraphQL
320
+ * `address(address:){ defaultNameRecord { domain } }` query. Returns a
321
+ * single-element array with the address's **default (primary)** name, or
322
+ * `[]` when it has none. Throws `SuinsRpcError` on transport failure.
325
323
  *
326
- * Why this is its own helper (not folded into `normalizeAddressInput`):
327
- * a reverse lookup adds a second RPC round-trip per tool call. We don't
328
- * want every read tool that takes an `address` to silently double its
329
- * latency. The lookup primitive is opt-in via the `resolve_suins` tool;
330
- * normalizers stay forward-only.
324
+ * Behavior note: the legacy JSON-RPC path returned *all* names for the
325
+ * address; GraphQL exposes the explicitly-configured default record, which is
326
+ * the one every consumer here actually uses (the LLM `resolve_suins` tool +
327
+ * card titles only ever render the primary). Returning `[primary]` keeps the
328
+ * `string[]` contract intact.
329
+ *
330
+ * Why this is its own helper (not folded into `normalizeAddressInput`): a
331
+ * reverse lookup adds a second round-trip per tool call. We don't want every
332
+ * read tool that takes an `address` to silently double its latency. The lookup
333
+ * primitive is opt-in via the `resolve_suins` tool; normalizers stay
334
+ * forward-only.
331
335
  */
332
336
  declare function resolveAddressToSuinsViaRpc(rawAddress: string, ctx?: {
333
337
  suiRpcUrl?: string;
@@ -372,6 +376,19 @@ declare function normalizeAddressInput(value: string, ctx?: {
372
376
  signal?: AbortSignal;
373
377
  }): Promise<NormalizedAddress>;
374
378
 
379
+ /**
380
+ * Full wallet balance: **every** held coin, not just the curated stables + SUI.
381
+ *
382
+ * Uses one `listBalances` (paginated) instead of N `getBalance` calls, then
383
+ * partitions: stables → priced $1, SUI → Cetus-oracle priced, **everything else
384
+ * → `tokens[]` amount-only** (`usdValue: null` — no price oracle for arbitrary
385
+ * tokens; we don't guess). Decimals for non-registry tokens are read on-chain
386
+ * (the only added call, and only for tokens you actually hold — necessary for a
387
+ * correct amount). `totalUsd` sums **priced holdings only** so it never
388
+ * overstates; `tokens` surfaces the rest honestly.
389
+ */
390
+ declare function queryBalance(client: SuiCoreClient, address: string): Promise<BalanceResponse>;
391
+
375
392
  declare function generateKeypair(): Ed25519Keypair;
376
393
  declare function keypairFromPrivateKey(privateKey: string): Ed25519Keypair;
377
394
  /**
@@ -405,72 +422,6 @@ declare function walletExists(keyPath?: string): Promise<boolean>;
405
422
  declare function exportPrivateKey(keypair: Ed25519Keypair): string;
406
423
  declare function getAddress(keypair: Ed25519Keypair): string;
407
424
 
408
- /**
409
- * Build a PTB that sends `amount` of `asset` from `address` to `to`.
410
- *
411
- * [v4.0 Phase A Day 2 — SPEC_AGENT_WALLET_GREENFIELD §A]
412
- *
413
- * Asset constraint: `'USDC' | 'USDsui' | 'SUI'` only. Other assets throw
414
- * `INVALID_ASSET` via `assertAllowedAsset('send', asset)`. The constrained
415
- * set matches Sui mainnet's gasless allowlist (USDC + USDsui) plus SUI
416
- * for users who want a gas-native transfer.
417
- *
418
- * Build paths:
419
- * - **USDC / USDsui** — `0x2::balance::send_funds` Move call with a
420
- * `tx.balance({ type, balance })` input. When built via `SuiGrpcClient`,
421
- * the gRPC resolver auto-detects gasless eligibility and zeros gas.
422
- * When built via `SuiJsonRpcClient`, the same PTB still executes but
423
- * the caller pays normal gas. Minimum 0.01 (protocol allowlist floor).
424
- * - **SUI** — `tx.splitCoins(tx.gas, [amount]) → tx.transferObjects()`.
425
- * Standard gas-native transfer. No minimum.
426
- *
427
- * Pre-flight balance check stays on JSON-RPC (`client.getBalance`) — it
428
- * sums coin objects + address balance so the legacy `getCoins` page miss
429
- * doesn't break for users whose stables landed via gasless deposits.
430
- *
431
- * `asset` is REQUIRED (no implicit USDC default — pre-v4 hid LLM intent
432
- * errors). Callers passing the wrong asset get an explicit error rather
433
- * than a silent currency substitution.
434
- */
435
- declare function buildSendTx({ client, address, to, amount, asset, }: {
436
- client: SuiCoreClient;
437
- address: string;
438
- to: string;
439
- amount: number;
440
- asset: SendableAsset;
441
- }): Promise<Transaction>;
442
- /**
443
- * Fragment-appender for the chain-mode send leg of SPEC 7 multi-write
444
- * Payment Intents. Consumes a coin reference produced by a previous
445
- * appender (e.g. `addWithdrawToTx`, `addSwapToTx`) and transfers it to
446
- * `recipient` within the same Payment Intent — no intermediate wallet
447
- * materialization.
448
- *
449
- * Codifies the hand-built send leg from
450
- * `scripts/smoke-spec7-withdraw-then-send.ts` (P2.1) into a typed
451
- * appender. SPEC 7 § "Layer 1" — P2.2b will register this in the
452
- * `WRITE_APPENDER_REGISTRY` under `send_transfer` for chain-mode
453
- * dispatch; the registry adapter will handle the wallet-fetch fallback
454
- * by delegating to `buildSendTx` when no upstream coin is available.
455
- *
456
- * For single-step send_transfer flows (no chained predecessor), use
457
- * `buildSendTx` directly — it builds a complete tx including the
458
- * wallet-coin selection / merge / split prelude.
459
- *
460
- * [v4.0 Phase A Day 2] Stays on the legacy `transferObjects` path
461
- * because chain-mode bundles are NEVER gasless — by definition they
462
- * combine multiple Move calls (`withdraw → send`, `swap → send`) which
463
- * fail the protocol allowlist check (only `balance::send_funds` and
464
- * a few related helpers are eligible). The bundled flow still works,
465
- * the user just pays gas (or has it sponsored by audric via Enoki).
466
- *
467
- * @returns void — the coin is consumed by `tx.transferObjects`. Callers
468
- * that need the post-transfer "effective amount" should rely on the
469
- * upstream appender's `effectiveAmount` (e.g. `addWithdrawToTx`'s
470
- * return), not on this appender.
471
- */
472
- declare function addSendToTx(tx: Transaction, coin: TransactionObjectArgument, recipient: string): void;
473
-
474
425
  /**
475
426
  * SPEC 7 v0.4 § Layer 0 — Canonical Write Architecture.
476
427
  *
@@ -977,4 +928,4 @@ declare function fullHandle(label: string): string;
977
928
  */
978
929
  declare function displayHandle(label: string): string;
979
930
 
980
- export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, buildSendTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
931
+ export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { SuiGrpcClient } from '@mysten/sui/grpc';
3
3
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
- import { T as T2000Error, at as T2000Options, F as TransactionSigner, P as PayOptions, k as PayResult, au as SwapResult, av as SwapQuoteResult, t as SupportedAsset, o as SendResult, B as BalanceResponse, A as TransactionRecord, e as DepositInfo, aw as PaymentRequest, Z as ZkLoginProof, ax as SuiCoreClient, ay as SendableAsset, j as OverlayFeeConfig, az as SponsoredCoinMergeCache, u as SwapRouteResult } from './simulate-KETPmlDo.js';
5
- export { aA as CETUS_USDC_SUI_POOL, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, aB as CoinPage, aC as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, E as ETH_TYPE, f as ExtractedTransfer, aD as GASLESS_MIN_STABLE_AMOUNT, aE as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, aF as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, aG as Operation, aH as SENDABLE_ASSETS, S as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, aI as SelectAndSplitResult, aJ as SerializedCetusRoute, aK as SerializedCetusRoutePath, aL as SerializedRouterDataV3, p as SimulationResult, q as StableAsset, r as SuiHolding, s as SuiRpcTxBlock, v as T2000ErrorCode, w as T2000ErrorData, x as T2000_OVERLAY_FEE_WALLET, y as TOKEN_MAP, z as TransactionLeg, H as TxDirection, U as USDC_DECIMALS, J as USDC_TYPE, Q as USDE_TYPE, R as USDSUI_TYPE, V as USDT_TYPE, W as WAL_TYPE, X as WBTC_TYPE, Y as ZkLoginSigner, aM as addSwapToTx, aN as assertAllowedAsset, _ as buildSwapTx, $ as classifyAction, a0 as classifyLabel, a1 as classifyTransaction, aO as deserializeCetusRoute, a2 as executeTx, a3 as extractAllUserLegs, a4 as extractTransferDetails, a5 as extractTxCommands, a6 as extractTxSender, a7 as fallbackLabel, aP as fetchAllCoins, a8 as findSwapRoute, a9 as formatAssetAmount, aa as formatSui, ab as formatUsd, aQ as getCoinMeta, ac as getDecimals, ad as getDecimalsForCoinType, aR as getSuiClient, aS as getSuiGrpcClient, aT as isAllowedAsset, aU as isCetusRouteFresh, aV as isInRegistry, ae as mapMoveAbortCode, af as mapWalletError, ag as mistToSui, aW as normalizeAsset, aX as normalizeCoinType, ah as parseSuiRpcTx, ai as payWithMpp, aY as queryHistory, aZ as queryTransaction, aj as rawToStable, ak as rawToUsdc, al as refineLendingLabel, am as resolveSymbol, an as resolveTokenType, a_ as selectAndSplitCoin, a$ as selectSuiCoin, b0 as serializeCetusRoute, b1 as simulateTransaction, ao as stableToRaw, ap as suiToMist, b2 as throwIfSimulationFailed, aq as truncateAddress, ar as usdcToRaw, as as validateAddress, b3 as verifyCetusRouteCoinMatch } from './simulate-KETPmlDo.js';
6
- import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
4
+ import { T as T2000Error, aD as T2000Options, Q as TransactionSigner, l as PayOptions, m as PayResult, aE as SwapResult, aF as SwapQuoteResult, w as SupportedAsset, r as SendResult, B as BalanceResponse, J as TransactionRecord, e as DepositInfo, aG as PaymentRequest, $ as ZkLoginProof, aH as SuiCoreClient, j as OverlayFeeConfig, aI as SponsoredCoinMergeCache, x as SwapRouteResult, aJ as SendableAsset } from './send-D2nKpwJN.js';
5
+ export { aK as CETUS_USDC_SUI_POOL, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, aL as CoinPage, aM as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, E as ETH_TYPE, f as ExtractedTransfer, aN as GASLESS_MIN_STABLE_AMOUNT, aO as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, aP as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, aQ as Operation, P as PREFLIGHT_MAX_AMOUNT, k as PREFLIGHT_OK, n as PreflightResult, aR as SENDABLE_ASSETS, S as STABLE_ASSETS, o as SUI_DECIMALS, p as SUI_TYPE, q as SUPPORTED_ASSETS, aS as SelectAndSplitResult, aT as SerializedCetusRoute, aU as SerializedCetusRoutePath, aV as SerializedRouterDataV3, s as SimulationResult, t as StableAsset, u as SuiHolding, v as SuiRpcTxBlock, y as T2000ErrorCode, z as T2000ErrorData, A as T2000_OVERLAY_FEE_WALLET, F as TOKEN_MAP, H as TransactionLeg, R as TxDirection, U as USDC_DECIMALS, V as USDC_TYPE, W as USDE_TYPE, X as USDSUI_TYPE, Y as USDT_TYPE, Z as WAL_TYPE, _ as WBTC_TYPE, a0 as ZkLoginSigner, aW as addSendToTx, aX as addSwapToTx, aY as assertAllowedAsset, a1 as buildSendTx, a2 as buildSwapTx, a3 as checkPositiveAmount, a4 as checkSuiAddress, a5 as classifyAction, a6 as classifyLabel, a7 as classifyTransaction, aZ as deserializeCetusRoute, a8 as executeTx, a9 as extractAllUserLegs, aa as extractTransferDetails, ab as extractTxCommands, ac as extractTxSender, ad as fallbackLabel, a_ as fetchAllCoins, ae as findSwapRoute, af as formatAssetAmount, ag as formatSui, ah as formatUsd, a$ as getCoinMeta, ai as getDecimals, aj as getDecimalsForCoinType, b0 as getSuiClient, b1 as getSuiGrpcClient, b2 as isAllowedAsset, b3 as isCetusRouteFresh, b4 as isInRegistry, ak as mapMoveAbortCode, al as mapWalletError, am as mistToSui, b5 as normalizeAsset, b6 as normalizeCoinType, an as parseSuiRpcTx, ao as payWithMpp, ap as preflightFail, aq as preflightPay, ar as preflightSend, as as preflightSwap, b7 as queryHistory, b8 as queryTransaction, at as rawToStable, au as rawToUsdc, av as refineLendingLabel, aw as resolveSymbol, ax as resolveTokenType, b9 as selectAndSplitCoin, ba as selectSuiCoin, bb as serializeCetusRoute, bc as simulateTransaction, ay as stableToRaw, az as suiToMist, bd as throwIfSimulationFailed, aA as truncateAddress, aB as usdcToRaw, aC as validateAddress, be as verifyCetusRouteCoinMatch } from './send-D2nKpwJN.js';
6
+ import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
7
7
  import { SuinsClient } from '@mysten/suins';
8
8
  import '@mysten/sui/client';
9
9
  import '@cetusprotocol/aggregator-sdk';
@@ -303,31 +303,35 @@ declare class SuinsRpcError extends Error {
303
303
  */
304
304
  declare function looksLikeSuiNs(value: string): boolean;
305
305
  /**
306
- * Resolve a SuiNS name to its on-chain Sui address via the public
307
- * `suix_resolveNameServiceAddress` JSON-RPC method. Returns `null` if
308
- * the name resolves to no address (= not registered or expired). Throws
309
- * `SuinsRpcError` on RPC/network failure.
306
+ * Resolve a SuiNS name to its on-chain Sui address via the Sui GraphQL
307
+ * `address(name:)` query. Returns `null` if the name resolves to no address
308
+ * (= not registered or expired). Throws `SuinsRpcError` on transport failure.
310
309
  *
311
- * The host SHOULD pass a `rpcUrl` that includes any vendor key (e.g.
312
- * audric's BlockVision-keyed URL) so the call benefits from the host's
313
- * paid retry/cache budget. Falls back to the public mainnet endpoint.
310
+ * `ctx.signal` is honored for cancellation. (`ctx.suiRpcUrl` is retained for
311
+ * call-site back-compat but no longer used resolution runs against the
312
+ * canonical GraphQL endpoint via `getSuiGraphQLClient()`.)
314
313
  */
315
314
  declare function resolveSuinsViaRpc(rawName: string, ctx?: {
316
315
  suiRpcUrl?: string;
317
316
  signal?: AbortSignal;
318
317
  }): Promise<string | null>;
319
318
  /**
320
- * Reverse-resolve a 0x address to its registered SuiNS names via
321
- * `suix_resolveNameServiceNames`. Returns the names sorted by the
322
- * registry (the first entry is conventionally the user's "primary"
323
- * name on dApps that show one), or `[]` when the address has no
324
- * SuiNS records. Throws `SuinsRpcError` on RPC/network failure.
319
+ * Reverse-resolve a 0x address to its SuiNS name via the Sui GraphQL
320
+ * `address(address:){ defaultNameRecord { domain } }` query. Returns a
321
+ * single-element array with the address's **default (primary)** name, or
322
+ * `[]` when it has none. Throws `SuinsRpcError` on transport failure.
325
323
  *
326
- * Why this is its own helper (not folded into `normalizeAddressInput`):
327
- * a reverse lookup adds a second RPC round-trip per tool call. We don't
328
- * want every read tool that takes an `address` to silently double its
329
- * latency. The lookup primitive is opt-in via the `resolve_suins` tool;
330
- * normalizers stay forward-only.
324
+ * Behavior note: the legacy JSON-RPC path returned *all* names for the
325
+ * address; GraphQL exposes the explicitly-configured default record, which is
326
+ * the one every consumer here actually uses (the LLM `resolve_suins` tool +
327
+ * card titles only ever render the primary). Returning `[primary]` keeps the
328
+ * `string[]` contract intact.
329
+ *
330
+ * Why this is its own helper (not folded into `normalizeAddressInput`): a
331
+ * reverse lookup adds a second round-trip per tool call. We don't want every
332
+ * read tool that takes an `address` to silently double its latency. The lookup
333
+ * primitive is opt-in via the `resolve_suins` tool; normalizers stay
334
+ * forward-only.
331
335
  */
332
336
  declare function resolveAddressToSuinsViaRpc(rawAddress: string, ctx?: {
333
337
  suiRpcUrl?: string;
@@ -372,6 +376,19 @@ declare function normalizeAddressInput(value: string, ctx?: {
372
376
  signal?: AbortSignal;
373
377
  }): Promise<NormalizedAddress>;
374
378
 
379
+ /**
380
+ * Full wallet balance: **every** held coin, not just the curated stables + SUI.
381
+ *
382
+ * Uses one `listBalances` (paginated) instead of N `getBalance` calls, then
383
+ * partitions: stables → priced $1, SUI → Cetus-oracle priced, **everything else
384
+ * → `tokens[]` amount-only** (`usdValue: null` — no price oracle for arbitrary
385
+ * tokens; we don't guess). Decimals for non-registry tokens are read on-chain
386
+ * (the only added call, and only for tokens you actually hold — necessary for a
387
+ * correct amount). `totalUsd` sums **priced holdings only** so it never
388
+ * overstates; `tokens` surfaces the rest honestly.
389
+ */
390
+ declare function queryBalance(client: SuiCoreClient, address: string): Promise<BalanceResponse>;
391
+
375
392
  declare function generateKeypair(): Ed25519Keypair;
376
393
  declare function keypairFromPrivateKey(privateKey: string): Ed25519Keypair;
377
394
  /**
@@ -405,72 +422,6 @@ declare function walletExists(keyPath?: string): Promise<boolean>;
405
422
  declare function exportPrivateKey(keypair: Ed25519Keypair): string;
406
423
  declare function getAddress(keypair: Ed25519Keypair): string;
407
424
 
408
- /**
409
- * Build a PTB that sends `amount` of `asset` from `address` to `to`.
410
- *
411
- * [v4.0 Phase A Day 2 — SPEC_AGENT_WALLET_GREENFIELD §A]
412
- *
413
- * Asset constraint: `'USDC' | 'USDsui' | 'SUI'` only. Other assets throw
414
- * `INVALID_ASSET` via `assertAllowedAsset('send', asset)`. The constrained
415
- * set matches Sui mainnet's gasless allowlist (USDC + USDsui) plus SUI
416
- * for users who want a gas-native transfer.
417
- *
418
- * Build paths:
419
- * - **USDC / USDsui** — `0x2::balance::send_funds` Move call with a
420
- * `tx.balance({ type, balance })` input. When built via `SuiGrpcClient`,
421
- * the gRPC resolver auto-detects gasless eligibility and zeros gas.
422
- * When built via `SuiJsonRpcClient`, the same PTB still executes but
423
- * the caller pays normal gas. Minimum 0.01 (protocol allowlist floor).
424
- * - **SUI** — `tx.splitCoins(tx.gas, [amount]) → tx.transferObjects()`.
425
- * Standard gas-native transfer. No minimum.
426
- *
427
- * Pre-flight balance check stays on JSON-RPC (`client.getBalance`) — it
428
- * sums coin objects + address balance so the legacy `getCoins` page miss
429
- * doesn't break for users whose stables landed via gasless deposits.
430
- *
431
- * `asset` is REQUIRED (no implicit USDC default — pre-v4 hid LLM intent
432
- * errors). Callers passing the wrong asset get an explicit error rather
433
- * than a silent currency substitution.
434
- */
435
- declare function buildSendTx({ client, address, to, amount, asset, }: {
436
- client: SuiCoreClient;
437
- address: string;
438
- to: string;
439
- amount: number;
440
- asset: SendableAsset;
441
- }): Promise<Transaction>;
442
- /**
443
- * Fragment-appender for the chain-mode send leg of SPEC 7 multi-write
444
- * Payment Intents. Consumes a coin reference produced by a previous
445
- * appender (e.g. `addWithdrawToTx`, `addSwapToTx`) and transfers it to
446
- * `recipient` within the same Payment Intent — no intermediate wallet
447
- * materialization.
448
- *
449
- * Codifies the hand-built send leg from
450
- * `scripts/smoke-spec7-withdraw-then-send.ts` (P2.1) into a typed
451
- * appender. SPEC 7 § "Layer 1" — P2.2b will register this in the
452
- * `WRITE_APPENDER_REGISTRY` under `send_transfer` for chain-mode
453
- * dispatch; the registry adapter will handle the wallet-fetch fallback
454
- * by delegating to `buildSendTx` when no upstream coin is available.
455
- *
456
- * For single-step send_transfer flows (no chained predecessor), use
457
- * `buildSendTx` directly — it builds a complete tx including the
458
- * wallet-coin selection / merge / split prelude.
459
- *
460
- * [v4.0 Phase A Day 2] Stays on the legacy `transferObjects` path
461
- * because chain-mode bundles are NEVER gasless — by definition they
462
- * combine multiple Move calls (`withdraw → send`, `swap → send`) which
463
- * fail the protocol allowlist check (only `balance::send_funds` and
464
- * a few related helpers are eligible). The bundled flow still works,
465
- * the user just pays gas (or has it sponsored by audric via Enoki).
466
- *
467
- * @returns void — the coin is consumed by `tx.transferObjects`. Callers
468
- * that need the post-transfer "effective amount" should rely on the
469
- * upstream appender's `effectiveAmount` (e.g. `addWithdrawToTx`'s
470
- * return), not on this appender.
471
- */
472
- declare function addSendToTx(tx: Transaction, coin: TransactionObjectArgument, recipient: string): void;
473
-
474
425
  /**
475
426
  * SPEC 7 v0.4 § Layer 0 — Canonical Write Architecture.
476
427
  *
@@ -977,4 +928,4 @@ declare function fullHandle(label: string): string;
977
928
  */
978
929
  declare function displayHandle(label: string): string;
979
930
 
980
- export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, buildSendTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
931
+ export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };