@t2000/sdk 3.2.0 → 4.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 +142 -253
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs +5 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +3 -2
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +5 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +255 -348
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +131 -148
- package/dist/index.d.ts +131 -148
- package/dist/index.js +249 -345
- package/dist/index.js.map +1 -1
- package/dist/{types-BmgPRlnq.d.ts → types-CqpN8a8R.d.cts} +56 -5
- package/dist/{types-Bk7NncQ_.d.cts → types-HJGbXJ37.d.cts} +1 -16
- package/dist/{types-Bk7NncQ_.d.ts → types-HJGbXJ37.d.ts} +1 -16
- package/dist/{types-Bh_0d-te.d.cts → types-_U9XXGFR.d.ts} +56 -5
- package/package.json +7 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, _ as ZkLoginProof,
|
|
5
|
-
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR,
|
|
4
|
+
import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, v as SupportedAsset, _ as ZkLoginProof, ax as SendableAsset } from './types-CqpN8a8R.cjs';
|
|
5
|
+
export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ay as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, az as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, aA as GASLESS_MIN_STABLE_AMOUNT, aB as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, aC as OPERATION_ASSETS, O as OUTBOUND_OPS, aD as Operation, P as ProtocolFeeInfo, aE as SAVEABLE_ASSETS, S as SAVE_FEE_BPS, aF as SENDABLE_ASSETS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, aG as SaveableAsset, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, $ as ZkLoginSigner, a0 as addFeeTransfer, aH as assertAllowedAsset, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, aI as createSuiClient, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, aJ as getCoinMeta, ad as getDecimals, ae as getDecimalsForCoinType, aK as getSuiClient, aL as getSuiGrpcClient, af as getTier, aM as isAllowedAsset, aN as isInRegistry, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, aO as normalizeAsset, aP as normalizeCoinType, am as parseSuiRpcTx, aQ as queryHistory, aR as queryTransaction, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, aS as simulateTransaction, as as stableToRaw, at as suiToMist, aT as throwIfSimulationFailed, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-CqpN8a8R.cjs';
|
|
6
6
|
import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-DqIb4AnV.cjs';
|
|
7
7
|
export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from './descriptors-DqIb4AnV.cjs';
|
|
8
|
-
import { n as T2000Options, P as PayOptions, d as PayResult, o as
|
|
9
|
-
export { A as AssetRates, G as GasReserve,
|
|
8
|
+
import { n as T2000Options, P as PayOptions, d as PayResult, o as SwapResult, p as SwapQuoteResult, i as SendResult, B as BalanceResponse, k as TransactionRecord, D as DepositInfo, q as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, r as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, j as SwapRouteResult, s as FinancialSummary } from './types-HJGbXJ37.cjs';
|
|
9
|
+
export { A as AssetRates, G as GasReserve, t as HFAlertLevel, O as OVERLAY_FEE_RATE, f as PositionEntry, u as SerializedCetusRoute, v as SerializedCetusRoutePath, w as SerializedRouterDataV3, T as TransactionLeg, x as addSwapToTx, l as buildSwapTx, y as deserializeCetusRoute, m as findSwapRoute, z as isCetusRouteFresh, I as serializeCetusRoute, J as verifyCetusRouteCoinMatch } from './types-HJGbXJ37.cjs';
|
|
10
10
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
11
11
|
import { SuinsClient } from '@mysten/suins';
|
|
12
12
|
export { NaviAdapter, ProtocolRegistry } from './adapters/index.cjs';
|
|
13
|
+
import '@mysten/sui/grpc';
|
|
13
14
|
import '@cetusprotocol/aggregator-sdk';
|
|
14
15
|
|
|
15
16
|
declare class SafeguardEnforcer {
|
|
@@ -95,8 +96,8 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
95
96
|
network?: 'mainnet' | 'testnet';
|
|
96
97
|
rpcUrl?: string;
|
|
97
98
|
}): T2000;
|
|
98
|
-
static init(options
|
|
99
|
-
pin
|
|
99
|
+
static init(options?: {
|
|
100
|
+
pin?: string;
|
|
100
101
|
passphrase?: string;
|
|
101
102
|
keyPath?: string;
|
|
102
103
|
name?: string;
|
|
@@ -111,12 +112,6 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
111
112
|
/** Transaction signer (works for both keypair and zkLogin). */
|
|
112
113
|
get signer(): TransactionSigner;
|
|
113
114
|
pay(options: PayOptions): Promise<PayResult>;
|
|
114
|
-
stakeVSui(params: {
|
|
115
|
-
amount: number;
|
|
116
|
-
}): Promise<StakeVSuiResult>;
|
|
117
|
-
unstakeVSui(params: {
|
|
118
|
-
amount: number | 'all';
|
|
119
|
-
}): Promise<UnstakeVSuiResult>;
|
|
120
115
|
swap(params: {
|
|
121
116
|
from: string;
|
|
122
117
|
to: string;
|
|
@@ -140,10 +135,31 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
140
135
|
providers?: string[];
|
|
141
136
|
}): Promise<SwapQuoteResult>;
|
|
142
137
|
address(): string;
|
|
138
|
+
/**
|
|
139
|
+
* Send `amount` of `asset` to `to` (hex address, SuiNS name, or
|
|
140
|
+
* `@audric` handle / saved contact).
|
|
141
|
+
*
|
|
142
|
+
* [v4.0 Phase A Day 2 — SPEC_AGENT_WALLET_GREENFIELD §A]
|
|
143
|
+
*
|
|
144
|
+
* **Breaking changes from v3.x:**
|
|
145
|
+
* - `asset` is now REQUIRED (no implicit `?? 'USDC'` default). Callers
|
|
146
|
+
* must specify `'USDC' | 'USDsui' | 'SUI'`. Sending `'USDT'` /
|
|
147
|
+
* `'USDe'` / `'WAL'` / `'ETH'` / `'NAVX'` / `'GOLD'` now errors
|
|
148
|
+
* with `INVALID_ASSET` — swap to a stable first.
|
|
149
|
+
* - USDC + USDsui builds go through `SuiGrpcClient` so the gRPC build
|
|
150
|
+
* resolver auto-detects `0x2::balance::send_funds` eligibility and
|
|
151
|
+
* zeros gas at simulate time. Result: **gasless USDC / USDsui sends
|
|
152
|
+
* from a zero-SUI wallet.** SUI sends stay on the standard gas-paid
|
|
153
|
+
* path.
|
|
154
|
+
*
|
|
155
|
+
* Submission stays on the JSON-RPC client (the rest of the SDK
|
|
156
|
+
* expects JSON-RPC for read paths, and Sui's docs explicitly support
|
|
157
|
+
* the "build via gRPC, execute via JSON-RPC" hybrid).
|
|
158
|
+
*/
|
|
143
159
|
send(params: {
|
|
144
160
|
to: string;
|
|
145
161
|
amount: number;
|
|
146
|
-
asset
|
|
162
|
+
asset: SupportedAsset;
|
|
147
163
|
}): Promise<SendResult>;
|
|
148
164
|
/**
|
|
149
165
|
* [S.279 / CLI-CONTACTS-CLEANUP — 2026-05-23] Resolve a recipient
|
|
@@ -183,11 +199,12 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
183
199
|
transactionDetail(digest: string): Promise<TransactionRecord | null>;
|
|
184
200
|
deposit(): Promise<DepositInfo>;
|
|
185
201
|
/**
|
|
186
|
-
* [SPEC_AGENTIC_STACK P1 / SDK F2
|
|
187
|
-
* Preferred alias of `deposit()`.
|
|
188
|
-
*
|
|
189
|
-
* `deposit()` stays as the canonical method name for
|
|
190
|
-
*
|
|
202
|
+
* [SPEC_AGENTIC_STACK P1 / SDK F2 — 2026-05-25; refreshed S.342 / 2026-05-26]
|
|
203
|
+
* Preferred alias of `deposit()`. Was introduced to mirror the v3 `t2000 fund`
|
|
204
|
+
* CLI command; the v4 CLI surface is `t2 receive` (deleted `fund` in the
|
|
205
|
+
* S.332 bulk cut). `deposit()` stays as the canonical method name for
|
|
206
|
+
* back-compat; `fund()` stays as a programmatic alias for audric + other
|
|
207
|
+
* SDK consumers that prefer the verb.
|
|
191
208
|
*/
|
|
192
209
|
fund(): Promise<DepositInfo>;
|
|
193
210
|
receive(params?: {
|
|
@@ -383,18 +400,70 @@ declare function normalizeAddressInput(value: string, ctx?: {
|
|
|
383
400
|
|
|
384
401
|
declare function generateKeypair(): Ed25519Keypair;
|
|
385
402
|
declare function keypairFromPrivateKey(privateKey: string): Ed25519Keypair;
|
|
386
|
-
|
|
387
|
-
|
|
403
|
+
/**
|
|
404
|
+
* Save a keypair as a v2 plain Bech32 JSON file with `0o600` perms.
|
|
405
|
+
*
|
|
406
|
+
* `_passphrase` is accepted but IGNORED — kept in the signature for
|
|
407
|
+
* back-compat with v3.x callers. Will be removed when all callers
|
|
408
|
+
* are off PIN (Phase A Day 5+).
|
|
409
|
+
*/
|
|
410
|
+
declare function saveKey(keypair: Ed25519Keypair, _passphrase: string | undefined, keyPath?: string): Promise<string>;
|
|
411
|
+
/**
|
|
412
|
+
* Save a Bech32 secret directly as a v2 plain wallet file. Used by any
|
|
413
|
+
* path where the secret is supplied externally rather than freshly
|
|
414
|
+
* generated. Kept exported because external tooling may still want it
|
|
415
|
+
* even though the CLI no longer ships an `--import` flag.
|
|
416
|
+
*/
|
|
417
|
+
declare function saveBech32(secret: string, keyPath?: string): Promise<string>;
|
|
418
|
+
/**
|
|
419
|
+
* Load a keypair from disk.
|
|
420
|
+
*
|
|
421
|
+
* `_passphrase` is accepted but IGNORED — kept for back-compat. The
|
|
422
|
+
* actual file format determines the load path:
|
|
423
|
+
*
|
|
424
|
+
* - **v2 plain JSON** (`{ version: 2, secret: "suiprivkey1..." }`) →
|
|
425
|
+
* decode + return keypair.
|
|
426
|
+
* - **Anything else** → throw `WALLET_CORRUPT`. The user moves or
|
|
427
|
+
* deletes the file and runs `t2 init` to create a fresh wallet.
|
|
428
|
+
*/
|
|
429
|
+
declare function loadKey(_passphrase?: string, keyPath?: string): Promise<Ed25519Keypair>;
|
|
388
430
|
declare function walletExists(keyPath?: string): Promise<boolean>;
|
|
389
431
|
declare function exportPrivateKey(keypair: Ed25519Keypair): string;
|
|
390
432
|
declare function getAddress(keypair: Ed25519Keypair): string;
|
|
391
433
|
|
|
434
|
+
/**
|
|
435
|
+
* Build a PTB that sends `amount` of `asset` from `address` to `to`.
|
|
436
|
+
*
|
|
437
|
+
* [v4.0 Phase A Day 2 — SPEC_AGENT_WALLET_GREENFIELD §A]
|
|
438
|
+
*
|
|
439
|
+
* Asset constraint: `'USDC' | 'USDsui' | 'SUI'` only. Other assets throw
|
|
440
|
+
* `INVALID_ASSET` via `assertAllowedAsset('send', asset)`. The constrained
|
|
441
|
+
* set matches Sui mainnet's gasless allowlist (USDC + USDsui) plus SUI
|
|
442
|
+
* for users who want a gas-native transfer.
|
|
443
|
+
*
|
|
444
|
+
* Build paths:
|
|
445
|
+
* - **USDC / USDsui** — `0x2::balance::send_funds` Move call with a
|
|
446
|
+
* `tx.balance({ type, balance })` input. When built via `SuiGrpcClient`,
|
|
447
|
+
* the gRPC resolver auto-detects gasless eligibility and zeros gas.
|
|
448
|
+
* When built via `SuiJsonRpcClient`, the same PTB still executes but
|
|
449
|
+
* the caller pays normal gas. Minimum 0.01 (protocol allowlist floor).
|
|
450
|
+
* - **SUI** — `tx.splitCoins(tx.gas, [amount]) → tx.transferObjects()`.
|
|
451
|
+
* Standard gas-native transfer. No minimum.
|
|
452
|
+
*
|
|
453
|
+
* Pre-flight balance check stays on JSON-RPC (`client.getBalance`) — it
|
|
454
|
+
* sums coin objects + address balance so the legacy `getCoins` page miss
|
|
455
|
+
* doesn't break for users whose stables landed via gasless deposits.
|
|
456
|
+
*
|
|
457
|
+
* `asset` is REQUIRED (no implicit USDC default — pre-v4 hid LLM intent
|
|
458
|
+
* errors). Callers passing the wrong asset get an explicit error rather
|
|
459
|
+
* than a silent currency substitution.
|
|
460
|
+
*/
|
|
392
461
|
declare function buildSendTx({ client, address, to, amount, asset, }: {
|
|
393
462
|
client: SuiJsonRpcClient;
|
|
394
463
|
address: string;
|
|
395
464
|
to: string;
|
|
396
465
|
amount: number;
|
|
397
|
-
asset
|
|
466
|
+
asset: SendableAsset;
|
|
398
467
|
}): Promise<Transaction>;
|
|
399
468
|
/**
|
|
400
469
|
* Fragment-appender for the chain-mode send leg of SPEC 7 multi-write
|
|
@@ -414,6 +483,13 @@ declare function buildSendTx({ client, address, to, amount, asset, }: {
|
|
|
414
483
|
* `buildSendTx` directly — it builds a complete tx including the
|
|
415
484
|
* wallet-coin selection / merge / split prelude.
|
|
416
485
|
*
|
|
486
|
+
* [v4.0 Phase A Day 2] Stays on the legacy `transferObjects` path
|
|
487
|
+
* because chain-mode bundles are NEVER gasless — by definition they
|
|
488
|
+
* combine multiple Move calls (`withdraw → send`, `swap → send`) which
|
|
489
|
+
* fail the protocol allowlist check (only `balance::send_funds` and
|
|
490
|
+
* a few related helpers are eligible). The bundled flow still works,
|
|
491
|
+
* the user just pays gas (or has it sponsored by audric via Enoki).
|
|
492
|
+
*
|
|
417
493
|
* @returns void — the coin is consumed by `tx.transferObjects`. Callers
|
|
418
494
|
* that need the post-transfer "effective amount" should rely on the
|
|
419
495
|
* upstream appender's `effectiveAmount` (e.g. `addWithdrawToTx`'s
|
|
@@ -583,13 +659,18 @@ declare function selectSuiCoin(tx: Transaction, client: SuiJsonRpcClient, owner:
|
|
|
583
659
|
*/
|
|
584
660
|
|
|
585
661
|
/**
|
|
586
|
-
* Canonical write tools. The
|
|
587
|
-
*
|
|
662
|
+
* Canonical write tools. The 8 tools that can be composed into a PTB.
|
|
663
|
+
*
|
|
664
|
+
* History:
|
|
665
|
+
* - 2026-05-08 (Track B): added `harvest_rewards` (compound macro).
|
|
666
|
+
* - 2026-05-25 (S.323): removed `volo_stake` / `volo_unstake` — full Volo
|
|
667
|
+
* cut across SDK/CLI/MCP after the engine cut Volo in S.277. vSUI
|
|
668
|
+
* remains as a passive token (NAVI reward, Cetus swap target).
|
|
588
669
|
*
|
|
589
670
|
* Excluded by design:
|
|
590
671
|
* - `save_contact` — no on-chain leg (Prisma-only).
|
|
591
672
|
*/
|
|
592
|
-
type WriteToolName = 'save_deposit' | 'withdraw' | 'borrow' | 'repay_debt' | 'send_transfer' | 'swap_execute' | 'claim_rewards' | 'harvest_rewards'
|
|
673
|
+
type WriteToolName = 'save_deposit' | 'withdraw' | 'borrow' | 'repay_debt' | 'send_transfer' | 'swap_execute' | 'claim_rewards' | 'harvest_rewards';
|
|
593
674
|
interface SaveDepositInput {
|
|
594
675
|
amount: number;
|
|
595
676
|
asset?: 'USDC' | 'USDsui';
|
|
@@ -606,10 +687,29 @@ interface RepayDebtInput {
|
|
|
606
687
|
amount: number;
|
|
607
688
|
asset?: 'USDC' | 'USDsui';
|
|
608
689
|
}
|
|
690
|
+
/**
|
|
691
|
+
* [v4.0 Phase A Day 2 — SPEC_AGENT_WALLET_GREENFIELD §A]
|
|
692
|
+
* `asset` is now REQUIRED (no more silent USDC default). The parameter
|
|
693
|
+
* type is the wider `SupportedAsset` rather than the narrower
|
|
694
|
+
* `SendableAsset` so callers that thread a wide-typed asset through
|
|
695
|
+
* (primarily the engine LLM tool surface) compile without modification.
|
|
696
|
+
* Runtime narrowing happens via `assertAllowedAsset('send', asset)`,
|
|
697
|
+
* which throws `INVALID_ASSET` for anything outside the
|
|
698
|
+
* `['USDC', 'USDsui', 'SUI']` whitelist. USDC + USDsui route through
|
|
699
|
+
* the gasless `0x2::balance::send_funds` Move call; SUI uses the
|
|
700
|
+
* standard `transferObjects` path.
|
|
701
|
+
*
|
|
702
|
+
* Audric hosts: the audric chat client (`audric-chat-client.tsx`)
|
|
703
|
+
* already defaults asset to `'USDC'` at the marker layer before
|
|
704
|
+
* calling `sponsoredTx({ type: 'send' })`, so this signature change
|
|
705
|
+
* doesn't break the LLM flow. LLM intents like "send 5 WAL" now
|
|
706
|
+
* surface a clear error instead of silently building a non-gasless
|
|
707
|
+
* tx.
|
|
708
|
+
*/
|
|
609
709
|
interface SendTransferInput {
|
|
610
710
|
to: string;
|
|
611
711
|
amount: number;
|
|
612
|
-
asset
|
|
712
|
+
asset: SupportedAsset;
|
|
613
713
|
}
|
|
614
714
|
interface SwapExecuteInput {
|
|
615
715
|
from: string;
|
|
@@ -644,12 +744,6 @@ interface HarvestRewardsInput {
|
|
|
644
744
|
/** USD floor for "is this worth swapping?" — dust below transfers to wallet. Default $0.01. */
|
|
645
745
|
minRewardUsd?: number;
|
|
646
746
|
}
|
|
647
|
-
interface VoloStakeInput {
|
|
648
|
-
amountSui: number;
|
|
649
|
-
}
|
|
650
|
-
interface VoloUnstakeInput {
|
|
651
|
-
amountVSui: number | 'all';
|
|
652
|
-
}
|
|
653
747
|
/**
|
|
654
748
|
* Discriminated union mapping `toolName` → `input`. Used to type
|
|
655
749
|
* `WriteStep` so consumers get autocomplete + compile-time validation
|
|
@@ -695,14 +789,6 @@ type WriteStep = {
|
|
|
695
789
|
} | {
|
|
696
790
|
toolName: 'harvest_rewards';
|
|
697
791
|
input: HarvestRewardsInput;
|
|
698
|
-
} | {
|
|
699
|
-
toolName: 'volo_stake';
|
|
700
|
-
input: VoloStakeInput;
|
|
701
|
-
inputCoinFromStep?: number;
|
|
702
|
-
} | {
|
|
703
|
-
toolName: 'volo_unstake';
|
|
704
|
-
input: VoloUnstakeInput;
|
|
705
|
-
inputCoinFromStep?: number;
|
|
706
792
|
};
|
|
707
793
|
interface ComposeTxOptions {
|
|
708
794
|
sender: string;
|
|
@@ -805,7 +891,7 @@ type StepPreview = {
|
|
|
805
891
|
toolName: 'send_transfer';
|
|
806
892
|
effectiveAmount: number;
|
|
807
893
|
recipient: string;
|
|
808
|
-
asset:
|
|
894
|
+
asset: SendableAsset;
|
|
809
895
|
} | {
|
|
810
896
|
toolName: 'swap_execute';
|
|
811
897
|
effectiveAmountIn: number;
|
|
@@ -831,12 +917,6 @@ type StepPreview = {
|
|
|
831
917
|
reason: 'untradeable' | 'dust' | 'no-route';
|
|
832
918
|
}>;
|
|
833
919
|
expectedUsdcDeposited: number;
|
|
834
|
-
} | {
|
|
835
|
-
toolName: 'volo_stake';
|
|
836
|
-
effectiveAmountMist: bigint;
|
|
837
|
-
} | {
|
|
838
|
-
toolName: 'volo_unstake';
|
|
839
|
-
effectiveAmountMist: bigint | 'all';
|
|
840
920
|
};
|
|
841
921
|
interface ComposeTxResult {
|
|
842
922
|
tx: Transaction;
|
|
@@ -898,8 +978,9 @@ interface AppenderContext {
|
|
|
898
978
|
* downstream consumer's `chainedCoin`. Terminal consumers
|
|
899
979
|
* (`save_deposit`, `repay_debt`, `send_transfer`) omit it.
|
|
900
980
|
*
|
|
901
|
-
* `swap_execute
|
|
902
|
-
*
|
|
981
|
+
* `swap_execute` is the only dual-mode tool — it accepts `chainedCoin`
|
|
982
|
+
* AND populates `outputCoin`. (`volo_stake` / `volo_unstake` were also
|
|
983
|
+
* dual-mode prior to S.323 / 2026-05-25; cut with the full Volo removal.)
|
|
903
984
|
*/
|
|
904
985
|
interface AppenderResult<TPreview extends StepPreview> {
|
|
905
986
|
preview: TPreview;
|
|
@@ -932,7 +1013,7 @@ declare function getSponsoredSwapProviders(): Promise<string[]>;
|
|
|
932
1013
|
/**
|
|
933
1014
|
* The typed registry. Each entry is a wallet-mode dispatcher that takes
|
|
934
1015
|
* (tx, input, ctx) and returns a per-step preview. Compile-time check
|
|
935
|
-
* that all
|
|
1016
|
+
* that all 8 `WriteToolName` values have an entry — TypeScript will
|
|
936
1017
|
* fail the build if a tool is missing.
|
|
937
1018
|
*/
|
|
938
1019
|
declare const WRITE_APPENDER_REGISTRY: {
|
|
@@ -960,12 +1041,6 @@ declare const WRITE_APPENDER_REGISTRY: {
|
|
|
960
1041
|
harvest_rewards: AppenderFn<HarvestRewardsInput, Extract<StepPreview, {
|
|
961
1042
|
toolName: 'harvest_rewards';
|
|
962
1043
|
}>>;
|
|
963
|
-
volo_stake: AppenderFn<VoloStakeInput, Extract<StepPreview, {
|
|
964
|
-
toolName: 'volo_stake';
|
|
965
|
-
}>>;
|
|
966
|
-
volo_unstake: AppenderFn<VoloUnstakeInput, Extract<StepPreview, {
|
|
967
|
-
toolName: 'volo_unstake';
|
|
968
|
-
}>>;
|
|
969
1044
|
};
|
|
970
1045
|
/**
|
|
971
1046
|
* Walks the assembled PTB's command list and extracts every recipient
|
|
@@ -1274,98 +1349,6 @@ declare function getSwapQuote(params: {
|
|
|
1274
1349
|
providers?: string[];
|
|
1275
1350
|
}): Promise<SwapQuoteResult>;
|
|
1276
1351
|
|
|
1277
|
-
/**
|
|
1278
|
-
* VOLO vSUI liquid staking — thin transaction builders.
|
|
1279
|
-
* No SDK dependency. Two Move calls, immutable contract addresses.
|
|
1280
|
-
*/
|
|
1281
|
-
|
|
1282
|
-
declare const VOLO_PKG = "0x68d22cf8bdbcd11ecba1e094922873e4080d4d11133e2443fddda0bfd11dae20";
|
|
1283
|
-
declare const VOLO_POOL = "0x2d914e23d82fedef1b5f56a32d5c64bdcc3087ccfea2b4d6ea51a71f587840e5";
|
|
1284
|
-
declare const VOLO_METADATA = "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60";
|
|
1285
|
-
declare const VSUI_TYPE = "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT";
|
|
1286
|
-
interface VoloStats {
|
|
1287
|
-
apy: number;
|
|
1288
|
-
exchangeRate: number;
|
|
1289
|
-
tvl: number;
|
|
1290
|
-
}
|
|
1291
|
-
/**
|
|
1292
|
-
* Fetch VOLO vSUI staking stats (APY, exchange rate, TVL).
|
|
1293
|
-
*/
|
|
1294
|
-
declare function getVoloStats(): Promise<VoloStats>;
|
|
1295
|
-
/**
|
|
1296
|
-
* Build a PTB to stake SUI for vSUI.
|
|
1297
|
-
*/
|
|
1298
|
-
declare function buildStakeVSuiTx(_client: SuiJsonRpcClient, address: string, amountMist: bigint): Promise<Transaction>;
|
|
1299
|
-
/**
|
|
1300
|
-
* Build a PTB to unstake vSUI back to SUI.
|
|
1301
|
-
*/
|
|
1302
|
-
declare function buildUnstakeVSuiTx(client: SuiJsonRpcClient, address: string, amountMist: bigint | 'all'): Promise<Transaction>;
|
|
1303
|
-
/**
|
|
1304
|
-
* SPEC 7 § "Layer 1" Volo stake appender. Two modes.
|
|
1305
|
-
*
|
|
1306
|
-
* Wallet mode (`inputCoin` omitted): pre-flights via `getBalance` and
|
|
1307
|
-
* sources SUI through `coinWithBalance({ type: SUI, useGasCoin: false })`,
|
|
1308
|
-
* which resolves coin objects + address balance at build time. Mirrors
|
|
1309
|
-
* the audric host's `transactions/prepare/route.ts:524-545` volo-stake
|
|
1310
|
-
* branch — sponsored-flow safe (does NOT consume `tx.gas`, which
|
|
1311
|
-
* belongs to the Enoki sponsor in sponsored flows).
|
|
1312
|
-
*
|
|
1313
|
-
* For non-sponsored flows where the caller owns `tx.gas`, prefer
|
|
1314
|
-
* `buildStakeVSuiTx` directly (it splits from gas, which avoids one
|
|
1315
|
-
* `getBalance` RTT).
|
|
1316
|
-
*
|
|
1317
|
-
* Chain mode (`inputCoin` provided): consumes the passed-in SUI coin
|
|
1318
|
-
* ref entirely. Used for chained flows like "swap USDC → SUI → stake".
|
|
1319
|
-
* The caller is responsible for splitting upstream if they only want
|
|
1320
|
-
* part of the input coin staked.
|
|
1321
|
-
*
|
|
1322
|
-
* @returns
|
|
1323
|
-
* - `coin`: vSUI output coin ref, ready for downstream consumption or
|
|
1324
|
-
* wallet transfer (`tx.transferObjects`).
|
|
1325
|
-
* - `effectiveAmountMist`: SUI mist consumed (echoes `input.amountMist`
|
|
1326
|
-
* in both modes; chain-mode trusts the caller-supplied value since
|
|
1327
|
-
* the actual coin balance is opaque).
|
|
1328
|
-
*/
|
|
1329
|
-
declare function addStakeVSuiToTx(tx: Transaction, client: SuiJsonRpcClient, address: string, input: {
|
|
1330
|
-
amountMist: bigint;
|
|
1331
|
-
inputCoin?: TransactionObjectArgument;
|
|
1332
|
-
}): Promise<{
|
|
1333
|
-
coin: TransactionObjectArgument;
|
|
1334
|
-
effectiveAmountMist: bigint;
|
|
1335
|
-
}>;
|
|
1336
|
-
/**
|
|
1337
|
-
* SPEC 7 § "Layer 1" Volo unstake appender. Two modes.
|
|
1338
|
-
*
|
|
1339
|
-
* Wallet mode (`inputCoin` omitted): pre-flights via `getBalance` and
|
|
1340
|
-
* sources vSUI through `coinWithBalance({ type: VSUI, balance })`,
|
|
1341
|
-
* which resolves coin objects + address balance at build time. With
|
|
1342
|
-
* `'all'`, the entire balance is consumed.
|
|
1343
|
-
*
|
|
1344
|
-
* Chain mode (`inputCoin` provided): consumes the passed-in vSUI coin
|
|
1345
|
-
* ref. With `amountMist = 'all'`, the entire input coin is unstaked.
|
|
1346
|
-
* With a bigint `amountMist`, the input coin is split internally and
|
|
1347
|
-
* only that portion unstaked (the leftover stays accessible via the
|
|
1348
|
-
* original ref). Used for chained flows where vSUI was just produced
|
|
1349
|
-
* by a prior step.
|
|
1350
|
-
*
|
|
1351
|
-
* @returns
|
|
1352
|
-
* - `coin`: SUI output coin ref, ready for downstream consumption
|
|
1353
|
-
* (e.g. `addSendToTx`, `addStakeVSuiToTx` re-stake) or wallet
|
|
1354
|
-
* transfer (`tx.transferObjects`).
|
|
1355
|
-
* - `effectiveAmountMist`: input vSUI mist consumed; echoes
|
|
1356
|
-
* `input.amountMist` (`'all'` is preserved as-is — the actual SUI
|
|
1357
|
-
* received differs from input vSUI by the pool exchange rate, so
|
|
1358
|
-
* callers needing the SUI amount must query `getVoloStats` or
|
|
1359
|
-
* parse balance changes from the executed tx).
|
|
1360
|
-
*/
|
|
1361
|
-
declare function addUnstakeVSuiToTx(tx: Transaction, client: SuiJsonRpcClient, address: string, input: {
|
|
1362
|
-
amountMist: bigint | 'all';
|
|
1363
|
-
inputCoin?: TransactionObjectArgument;
|
|
1364
|
-
}): Promise<{
|
|
1365
|
-
coin: TransactionObjectArgument;
|
|
1366
|
-
effectiveAmountMist: bigint | 'all';
|
|
1367
|
-
}>;
|
|
1368
|
-
|
|
1369
1352
|
/**
|
|
1370
1353
|
* SuiNS leaf-subname builders for the `audric.sui` parent NFT.
|
|
1371
1354
|
*
|
|
@@ -1505,4 +1488,4 @@ declare function fullHandle(label: string): string;
|
|
|
1505
1488
|
*/
|
|
1506
1489
|
declare function displayHandle(label: string): string;
|
|
1507
1490
|
|
|
1508
|
-
export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BorrowInput, BorrowResult, type BuildAddLeafParams, type BuildHarvestRewardsTxOptions, type BuildRevokeLeafParams, type ClaimRewardsInput, ClaimRewardsResult, type CoinPage, type ComposeTxFeeHookContext, type ComposeTxFeeHooks, type ComposeTxOptions, type ComposeTxResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, type HarvestPlan, type HarvestSkippedLeg, type HarvestSwapLeg, HealthFactorResult, InvalidAddressError, type LabelValidationResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput,
|
|
1491
|
+
export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BorrowInput, BorrowResult, type BuildAddLeafParams, type BuildHarvestRewardsTxOptions, type BuildRevokeLeafParams, type ClaimRewardsInput, ClaimRewardsResult, type CoinPage, type ComposeTxFeeHookContext, type ComposeTxFeeHooks, type ComposeTxOptions, type ComposeTxResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, type HarvestPlan, type HarvestSkippedLeg, type HarvestSwapLeg, HealthFactorResult, InvalidAddressError, type LabelValidationResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addClaimRewardsToTx, addSendToTx, aggregateClaimableRewards, buildAddLeafTx, buildClaimRewardsTx, buildHarvestRewardsTx, buildRevokeLeafTx, buildSendTx, composeTx, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fetchAllCoins, fullHandle, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getPendingRewardsByAddress, getRates, getSponsoredSwapProviders, getSwapQuote, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, validateLabel, walletExists };
|