@t2000/sdk 1.23.1 → 1.24.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/dist/index.d.cts CHANGED
@@ -433,14 +433,15 @@ declare function selectSuiCoin(tx: Transaction, client: SuiJsonRpcClient, owner:
433
433
  */
434
434
 
435
435
  /**
436
- * Canonical write tools. The 9 tools that can be composed into a PTB.
436
+ * Canonical write tools. The 10 tools that can be composed into a PTB
437
+ * (Track B 2026-05-08 added `harvest_rewards`).
437
438
  *
438
439
  * Excluded by design:
439
440
  * - `pay_api` — recipient/amount unknown at compose time; the on-chain
440
441
  * leg uses `send_transfer` after the gateway 402 challenge resolves.
441
442
  * - `save_contact` — no on-chain leg (Prisma-only).
442
443
  */
443
- type WriteToolName = 'save_deposit' | 'withdraw' | 'borrow' | 'repay_debt' | 'send_transfer' | 'swap_execute' | 'claim_rewards' | 'volo_stake' | 'volo_unstake';
444
+ type WriteToolName = 'save_deposit' | 'withdraw' | 'borrow' | 'repay_debt' | 'send_transfer' | 'swap_execute' | 'claim_rewards' | 'harvest_rewards' | 'volo_stake' | 'volo_unstake';
444
445
  interface SaveDepositInput {
445
446
  amount: number;
446
447
  asset?: 'USDC' | 'USDsui';
@@ -474,6 +475,18 @@ interface SwapExecuteInput {
474
475
  providers?: string[];
475
476
  }
476
477
  type ClaimRewardsInput = Record<string, never>;
478
+ /**
479
+ * [Track B] `harvest_rewards` accepts only optional tunables — no required
480
+ * inputs, since the user's choice is binary ("harvest now" or not). Default
481
+ * slippage 1%, default dust floor $0.01. The audric host's HARVEST chip
482
+ * passes literal `{}` and gets sensible defaults.
483
+ */
484
+ interface HarvestRewardsInput {
485
+ /** Per-swap slippage tolerance (0.001–0.05). Default 0.01 (1%). */
486
+ slippage?: number;
487
+ /** USD floor for "is this worth swapping?" — dust below transfers to wallet. Default $0.01. */
488
+ minRewardUsd?: number;
489
+ }
477
490
  interface VoloStakeInput {
478
491
  amountSui: number;
479
492
  }
@@ -522,6 +535,9 @@ type WriteStep = {
522
535
  } | {
523
536
  toolName: 'claim_rewards';
524
537
  input: ClaimRewardsInput;
538
+ } | {
539
+ toolName: 'harvest_rewards';
540
+ input: HarvestRewardsInput;
525
541
  } | {
526
542
  toolName: 'volo_stake';
527
543
  input: VoloStakeInput;
@@ -641,6 +657,23 @@ type StepPreview = {
641
657
  } | {
642
658
  toolName: 'claim_rewards';
643
659
  rewards: PendingReward$1[];
660
+ } | {
661
+ toolName: 'harvest_rewards';
662
+ claimed: PendingReward$1[];
663
+ swaps: Array<{
664
+ fromSymbol: string;
665
+ fromCoinType: string;
666
+ toSymbol: 'USDC';
667
+ inputAmount: number;
668
+ expectedOutputUsdc: number;
669
+ }>;
670
+ skipped: Array<{
671
+ symbol: string;
672
+ coinType: string;
673
+ amount: number;
674
+ reason: 'untradeable' | 'dust' | 'no-route';
675
+ }>;
676
+ expectedUsdcDeposited: number;
644
677
  } | {
645
678
  toolName: 'volo_stake';
646
679
  effectiveAmountMist: bigint;
@@ -719,7 +752,7 @@ type AppenderFn<TInput, TPreview extends StepPreview> = (tx: Transaction, input:
719
752
  /**
720
753
  * The typed registry. Each entry is a wallet-mode dispatcher that takes
721
754
  * (tx, input, ctx) and returns a per-step preview. Compile-time check
722
- * that all 9 `WriteToolName` values have an entry — TypeScript will
755
+ * that all 10 `WriteToolName` values have an entry — TypeScript will
723
756
  * fail the build if a tool is missing.
724
757
  */
725
758
  declare const WRITE_APPENDER_REGISTRY: {
@@ -744,6 +777,9 @@ declare const WRITE_APPENDER_REGISTRY: {
744
777
  claim_rewards: AppenderFn<ClaimRewardsInput, Extract<StepPreview, {
745
778
  toolName: 'claim_rewards';
746
779
  }>>;
780
+ harvest_rewards: AppenderFn<HarvestRewardsInput, Extract<StepPreview, {
781
+ toolName: 'harvest_rewards';
782
+ }>>;
747
783
  volo_stake: AppenderFn<VoloStakeInput, Extract<StepPreview, {
748
784
  toolName: 'volo_stake';
749
785
  }>>;
@@ -793,6 +829,28 @@ type FinancialSummaryOptions = Record<string, never>;
793
829
  declare function getFinancialSummary(client: SuiJsonRpcClient, walletAddress: string, _options?: FinancialSummaryOptions): Promise<FinancialSummary>;
794
830
 
795
831
  declare function getRates(client: SuiJsonRpcClient): Promise<RatesResult>;
832
+ /**
833
+ * [Track B follow-up / 2026-05-08] Stateless wrapper around `getPendingRewards`
834
+ * that creates its own `SuiJsonRpcClient`. Used by the engine's
835
+ * `pending_rewards` tool — engine doesn't import `@mysten/sui` directly
836
+ * (would expand its dep surface), so this helper accepts just `(address,
837
+ * suiRpcUrl?)` and instantiates the client internally.
838
+ *
839
+ * **Why this exists.** Pre-fix the engine tool went through
840
+ * `requireAgent(context).getPendingRewards()`, which threw
841
+ * "Tool requires a T2000 agent instance — pass `agent` in EngineConfig"
842
+ * in audric prod (audric uses sponsored-tx flow, never instantiates a
843
+ * T2000 agent). Live mainnet smoke on funkii's wallet 2026-05-08 caught
844
+ * this immediately when the LLM correctly called pending_rewards before
845
+ * harvest_rewards. This helper makes the audric/CLI paths symmetric
846
+ * (both work, neither requires an agent).
847
+ *
848
+ * Defaults `suiRpcUrl` to mainnet fullnode for CLI / standalone callers
849
+ * that don't pass one. Errors propagate with the same `T2000Error`
850
+ * shape as the underlying `getPendingRewards` (PROTOCOL_UNAVAILABLE on
851
+ * NAVI degradation, etc.) so the engine tool's catch path is unchanged.
852
+ */
853
+ declare function getPendingRewardsByAddress(address: string, suiRpcUrl?: string): Promise<PendingReward$1[]>;
796
854
  declare function getPendingRewards(client: SuiJsonRpcClient, address: string): Promise<PendingReward$1[]>;
797
855
  declare function addClaimRewardsToTx(tx: Transaction, client: SuiJsonRpcClient, address: string): Promise<PendingReward$1[]>;
798
856
  /**
@@ -839,6 +897,136 @@ interface ClaimableRewardLike {
839
897
  */
840
898
  declare function aggregateClaimableRewards(claimable: ClaimableRewardLike[]): PendingReward$1[];
841
899
 
900
+ /**
901
+ * NAVI rewards harvest — single-PTB compound flow.
902
+ *
903
+ * **Goal.** Bundle the three-step "claim → swap → save" reward-cycling
904
+ * routine into ONE atomic Programmable Transaction Block so the user
905
+ * sees ONE confirm card instead of three sequential ones, and so the
906
+ * legs settle together (or revert together — no half-claimed-but-
907
+ * unsaved drift).
908
+ *
909
+ * **Flow.**
910
+ * 1. Read pending rewards via NAVI's `getUserAvailableLendingRewards`
911
+ * (same source as `getPendingRewards` + `addClaimRewardsToTx`, so
912
+ * what the user sees in `pending_rewards` is exactly what gets
913
+ * harvested — no drift).
914
+ * 2. Append `claimLendingRewardsPTB(... { customCoinReceive: { type: 'skip' }})`
915
+ * so the claimed coin handles are returned as `TransactionObjectArgument`
916
+ * handles instead of being transferred to the wallet — they stay
917
+ * consumable inside the same PTB.
918
+ * 3. For each claimed handle:
919
+ * • If the reward IS USDC, hold the handle for the deposit step.
920
+ * • If the reward is in `COIN_REGISTRY` AND tradeable on Cetus
921
+ * (any tier-2 token effectively), append `addSwapToTx` in chain
922
+ * mode using the claimed coin as `inputCoin`. Collect the USDC
923
+ * output handle.
924
+ * • Else (untradeable / non-registry), transfer the claimed coin
925
+ * back to the user's wallet — preserves the reward but skips
926
+ * the auto-deposit (the user keeps it as a wallet asset).
927
+ * 4. Merge all collected USDC handles via `tx.mergeCoins`, then deposit
928
+ * via `addSaveToTx`.
929
+ *
930
+ * **Atomicity.** Single PTB = single transaction = single sponsored-gas
931
+ * envelope. Either ALL legs settle (claim + swap(s) + deposit) or none
932
+ * do. No partial-state recovery code needed.
933
+ *
934
+ * **Sponsored-gas posture.** This builder appends ONLY chained move
935
+ * calls — no `tx.gas` reads, no Pyth fee writes, no oracle Pyth updates.
936
+ * Cetus chain-mode swaps with `slippage` ≤ 5% don't require Pyth either
937
+ * (Cetus aggregator routes around Pyth-dependent providers when callers
938
+ * pass `providers: getProvidersExcluding(...)`). Audric's host wires
939
+ * the provider exclusion automatically for Enoki sponsorship — see
940
+ * `cetus-swap.ts` JSDoc.
941
+ *
942
+ * **Dust filter.** Rewards with `amount * priceCache.get(symbol) <
943
+ * minRewardUsd` are skipped from the swap leg AND from the deposit —
944
+ * not worth the gas to swap dust. They get transferred back to the
945
+ * wallet (preserving on-chain truth: the claim happened, the swap
946
+ * didn't). Default minRewardUsd = $0.01.
947
+ *
948
+ * **Failure modes.**
949
+ * - PROTOCOL_UNAVAILABLE — NAVI rewards lookup or claim PTB build failed.
950
+ * Engine surfaces "NAVI is degraded right now."
951
+ * - SWAP_NO_ROUTE — a reward asset has no Cetus route. Logged + that
952
+ * leg is skipped (rewards transferred to wallet). Other legs proceed.
953
+ * - INVALID_AMOUNT — rewards array empty after dust filter (nothing
954
+ * worth harvesting). Throws so the engine narrates "nothing to
955
+ * harvest right now" instead of building a no-op PTB.
956
+ *
957
+ * **Why a separate file (not inside `navi.ts`).** This composition
958
+ * crosses two protocols (NAVI + Cetus) — keeping it out of `navi.ts`
959
+ * preserves the single-protocol-per-file invariant the rest of the SDK
960
+ * follows. Mirrors how `cetus-swap.ts` already lives separately even
961
+ * though it composes through `composeTx.ts`.
962
+ */
963
+
964
+ interface HarvestSwapLeg {
965
+ /** Reward symbol pre-swap (e.g. 'vSUI', 'NAVX'). */
966
+ fromSymbol: string;
967
+ /** Reward coinType pre-swap. */
968
+ fromCoinType: string;
969
+ /** Always 'USDC' — this builder only deposits to the USDC pool. */
970
+ toSymbol: 'USDC';
971
+ /** Display-units input amount (the entire claimed reward for that coin). */
972
+ inputAmount: number;
973
+ /** Display-units USDC the swap quote estimated. Actual on-chain may differ within slippage. */
974
+ expectedOutputUsdc: number;
975
+ }
976
+ interface HarvestSkippedLeg {
977
+ /** Reward symbol skipped (untradeable, dust, or no-route). */
978
+ symbol: string;
979
+ coinType: string;
980
+ /** Display-units claimed amount (still credited to user's wallet — just not auto-deposited). */
981
+ amount: number;
982
+ /** 'untradeable' | 'dust' | 'no-route' */
983
+ reason: 'untradeable' | 'dust' | 'no-route';
984
+ }
985
+ interface HarvestPlan {
986
+ /** Every reward that WILL be claimed by this PTB. */
987
+ claimed: PendingReward$1[];
988
+ /** Each non-USDC reward that WILL be swapped to USDC inline. */
989
+ swaps: HarvestSwapLeg[];
990
+ /** Rewards claimed but transferred back to wallet (no auto-deposit). */
991
+ skipped: HarvestSkippedLeg[];
992
+ /** Display-units USDC that will be deposited to the NAVI USDC pool. */
993
+ expectedUsdcDeposited: number;
994
+ }
995
+ interface BuildHarvestRewardsTxOptions {
996
+ /** Per-swap slippage tolerance (0.001–0.05). Defaults to 0.01 (1%). */
997
+ slippage?: number;
998
+ /**
999
+ * USD floor for "is this worth swapping?". Rewards below this threshold
1000
+ * get transferred back to the wallet instead of swapped. Default $0.01.
1001
+ * Pass 0 to disable the filter (always swap; useful for tests).
1002
+ */
1003
+ minRewardUsd?: number;
1004
+ /**
1005
+ * Symbol → USD price map. Sourced from the engine's `ToolContext.priceCache`
1006
+ * in production; tests can pass a literal Map. When undefined, the dust
1007
+ * filter degrades to "skip nothing" (every reward is swapped) so we don't
1008
+ * accidentally drop large rewards just because we couldn't price them.
1009
+ */
1010
+ priceCache?: Map<string, number>;
1011
+ /**
1012
+ * Cetus provider allow-list. Sponsored callers (Enoki) pass
1013
+ * `getProvidersExcluding(['pyth-dependent-list'])` to keep the PTB
1014
+ * Pyth-free. Non-sponsored callers omit this.
1015
+ */
1016
+ providers?: string[];
1017
+ }
1018
+ /**
1019
+ * Standalone harvest builder — creates a fresh PTB, sets the sender,
1020
+ * appends the full harvest flow, and returns both the tx and the plan.
1021
+ * Used by CLI / direct SDK callers (smoke tests, scripts). The audric
1022
+ * host goes through `composeTx({ steps: [{ toolName: 'harvest_rewards' }] })`
1023
+ * which wires the appender + Enoki sponsorship.
1024
+ */
1025
+ declare function buildHarvestRewardsTx(client: SuiJsonRpcClient, address: string, options?: BuildHarvestRewardsTxOptions): Promise<{
1026
+ tx: Transaction;
1027
+ plan: HarvestPlan;
1028
+ }>;
1029
+
842
1030
  declare function getSwapQuote(params: {
843
1031
  walletAddress: string;
844
1032
  from: string;
@@ -1076,4 +1264,4 @@ declare function fullHandle(label: string): string;
1076
1264
  */
1077
1265
  declare function displayHandle(label: string): string;
1078
1266
 
1079
- export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BorrowInput, BorrowResult, type BuildAddLeafParams, 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, HealthFactorResult, type LabelValidationResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, StakeVSuiResult, type StepPreview, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStakeInput, type VoloStats, type VoloUnstakeInput, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addClaimRewardsToTx, addSendToTx, addStakeVSuiToTx, addUnstakeVSuiToTx, aggregateClaimableRewards, buildAddLeafTx, buildClaimRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildUnstakeVSuiTx, composeTx, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fetchAllCoins, fullHandle, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, selectAndSplitCoin, selectSuiCoin, validateLabel, walletExists };
1267
+ 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, type LabelValidationResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, StakeVSuiResult, type StepPreview, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStakeInput, type VoloStats, type VoloUnstakeInput, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addClaimRewardsToTx, addSendToTx, addStakeVSuiToTx, addUnstakeVSuiToTx, aggregateClaimableRewards, buildAddLeafTx, buildClaimRewardsTx, buildHarvestRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildUnstakeVSuiTx, composeTx, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fetchAllCoins, fullHandle, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getPendingRewardsByAddress, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, selectAndSplitCoin, selectSuiCoin, validateLabel, walletExists };
package/dist/index.d.ts CHANGED
@@ -433,14 +433,15 @@ declare function selectSuiCoin(tx: Transaction, client: SuiJsonRpcClient, owner:
433
433
  */
434
434
 
435
435
  /**
436
- * Canonical write tools. The 9 tools that can be composed into a PTB.
436
+ * Canonical write tools. The 10 tools that can be composed into a PTB
437
+ * (Track B 2026-05-08 added `harvest_rewards`).
437
438
  *
438
439
  * Excluded by design:
439
440
  * - `pay_api` — recipient/amount unknown at compose time; the on-chain
440
441
  * leg uses `send_transfer` after the gateway 402 challenge resolves.
441
442
  * - `save_contact` — no on-chain leg (Prisma-only).
442
443
  */
443
- type WriteToolName = 'save_deposit' | 'withdraw' | 'borrow' | 'repay_debt' | 'send_transfer' | 'swap_execute' | 'claim_rewards' | 'volo_stake' | 'volo_unstake';
444
+ type WriteToolName = 'save_deposit' | 'withdraw' | 'borrow' | 'repay_debt' | 'send_transfer' | 'swap_execute' | 'claim_rewards' | 'harvest_rewards' | 'volo_stake' | 'volo_unstake';
444
445
  interface SaveDepositInput {
445
446
  amount: number;
446
447
  asset?: 'USDC' | 'USDsui';
@@ -474,6 +475,18 @@ interface SwapExecuteInput {
474
475
  providers?: string[];
475
476
  }
476
477
  type ClaimRewardsInput = Record<string, never>;
478
+ /**
479
+ * [Track B] `harvest_rewards` accepts only optional tunables — no required
480
+ * inputs, since the user's choice is binary ("harvest now" or not). Default
481
+ * slippage 1%, default dust floor $0.01. The audric host's HARVEST chip
482
+ * passes literal `{}` and gets sensible defaults.
483
+ */
484
+ interface HarvestRewardsInput {
485
+ /** Per-swap slippage tolerance (0.001–0.05). Default 0.01 (1%). */
486
+ slippage?: number;
487
+ /** USD floor for "is this worth swapping?" — dust below transfers to wallet. Default $0.01. */
488
+ minRewardUsd?: number;
489
+ }
477
490
  interface VoloStakeInput {
478
491
  amountSui: number;
479
492
  }
@@ -522,6 +535,9 @@ type WriteStep = {
522
535
  } | {
523
536
  toolName: 'claim_rewards';
524
537
  input: ClaimRewardsInput;
538
+ } | {
539
+ toolName: 'harvest_rewards';
540
+ input: HarvestRewardsInput;
525
541
  } | {
526
542
  toolName: 'volo_stake';
527
543
  input: VoloStakeInput;
@@ -641,6 +657,23 @@ type StepPreview = {
641
657
  } | {
642
658
  toolName: 'claim_rewards';
643
659
  rewards: PendingReward$1[];
660
+ } | {
661
+ toolName: 'harvest_rewards';
662
+ claimed: PendingReward$1[];
663
+ swaps: Array<{
664
+ fromSymbol: string;
665
+ fromCoinType: string;
666
+ toSymbol: 'USDC';
667
+ inputAmount: number;
668
+ expectedOutputUsdc: number;
669
+ }>;
670
+ skipped: Array<{
671
+ symbol: string;
672
+ coinType: string;
673
+ amount: number;
674
+ reason: 'untradeable' | 'dust' | 'no-route';
675
+ }>;
676
+ expectedUsdcDeposited: number;
644
677
  } | {
645
678
  toolName: 'volo_stake';
646
679
  effectiveAmountMist: bigint;
@@ -719,7 +752,7 @@ type AppenderFn<TInput, TPreview extends StepPreview> = (tx: Transaction, input:
719
752
  /**
720
753
  * The typed registry. Each entry is a wallet-mode dispatcher that takes
721
754
  * (tx, input, ctx) and returns a per-step preview. Compile-time check
722
- * that all 9 `WriteToolName` values have an entry — TypeScript will
755
+ * that all 10 `WriteToolName` values have an entry — TypeScript will
723
756
  * fail the build if a tool is missing.
724
757
  */
725
758
  declare const WRITE_APPENDER_REGISTRY: {
@@ -744,6 +777,9 @@ declare const WRITE_APPENDER_REGISTRY: {
744
777
  claim_rewards: AppenderFn<ClaimRewardsInput, Extract<StepPreview, {
745
778
  toolName: 'claim_rewards';
746
779
  }>>;
780
+ harvest_rewards: AppenderFn<HarvestRewardsInput, Extract<StepPreview, {
781
+ toolName: 'harvest_rewards';
782
+ }>>;
747
783
  volo_stake: AppenderFn<VoloStakeInput, Extract<StepPreview, {
748
784
  toolName: 'volo_stake';
749
785
  }>>;
@@ -793,6 +829,28 @@ type FinancialSummaryOptions = Record<string, never>;
793
829
  declare function getFinancialSummary(client: SuiJsonRpcClient, walletAddress: string, _options?: FinancialSummaryOptions): Promise<FinancialSummary>;
794
830
 
795
831
  declare function getRates(client: SuiJsonRpcClient): Promise<RatesResult>;
832
+ /**
833
+ * [Track B follow-up / 2026-05-08] Stateless wrapper around `getPendingRewards`
834
+ * that creates its own `SuiJsonRpcClient`. Used by the engine's
835
+ * `pending_rewards` tool — engine doesn't import `@mysten/sui` directly
836
+ * (would expand its dep surface), so this helper accepts just `(address,
837
+ * suiRpcUrl?)` and instantiates the client internally.
838
+ *
839
+ * **Why this exists.** Pre-fix the engine tool went through
840
+ * `requireAgent(context).getPendingRewards()`, which threw
841
+ * "Tool requires a T2000 agent instance — pass `agent` in EngineConfig"
842
+ * in audric prod (audric uses sponsored-tx flow, never instantiates a
843
+ * T2000 agent). Live mainnet smoke on funkii's wallet 2026-05-08 caught
844
+ * this immediately when the LLM correctly called pending_rewards before
845
+ * harvest_rewards. This helper makes the audric/CLI paths symmetric
846
+ * (both work, neither requires an agent).
847
+ *
848
+ * Defaults `suiRpcUrl` to mainnet fullnode for CLI / standalone callers
849
+ * that don't pass one. Errors propagate with the same `T2000Error`
850
+ * shape as the underlying `getPendingRewards` (PROTOCOL_UNAVAILABLE on
851
+ * NAVI degradation, etc.) so the engine tool's catch path is unchanged.
852
+ */
853
+ declare function getPendingRewardsByAddress(address: string, suiRpcUrl?: string): Promise<PendingReward$1[]>;
796
854
  declare function getPendingRewards(client: SuiJsonRpcClient, address: string): Promise<PendingReward$1[]>;
797
855
  declare function addClaimRewardsToTx(tx: Transaction, client: SuiJsonRpcClient, address: string): Promise<PendingReward$1[]>;
798
856
  /**
@@ -839,6 +897,136 @@ interface ClaimableRewardLike {
839
897
  */
840
898
  declare function aggregateClaimableRewards(claimable: ClaimableRewardLike[]): PendingReward$1[];
841
899
 
900
+ /**
901
+ * NAVI rewards harvest — single-PTB compound flow.
902
+ *
903
+ * **Goal.** Bundle the three-step "claim → swap → save" reward-cycling
904
+ * routine into ONE atomic Programmable Transaction Block so the user
905
+ * sees ONE confirm card instead of three sequential ones, and so the
906
+ * legs settle together (or revert together — no half-claimed-but-
907
+ * unsaved drift).
908
+ *
909
+ * **Flow.**
910
+ * 1. Read pending rewards via NAVI's `getUserAvailableLendingRewards`
911
+ * (same source as `getPendingRewards` + `addClaimRewardsToTx`, so
912
+ * what the user sees in `pending_rewards` is exactly what gets
913
+ * harvested — no drift).
914
+ * 2. Append `claimLendingRewardsPTB(... { customCoinReceive: { type: 'skip' }})`
915
+ * so the claimed coin handles are returned as `TransactionObjectArgument`
916
+ * handles instead of being transferred to the wallet — they stay
917
+ * consumable inside the same PTB.
918
+ * 3. For each claimed handle:
919
+ * • If the reward IS USDC, hold the handle for the deposit step.
920
+ * • If the reward is in `COIN_REGISTRY` AND tradeable on Cetus
921
+ * (any tier-2 token effectively), append `addSwapToTx` in chain
922
+ * mode using the claimed coin as `inputCoin`. Collect the USDC
923
+ * output handle.
924
+ * • Else (untradeable / non-registry), transfer the claimed coin
925
+ * back to the user's wallet — preserves the reward but skips
926
+ * the auto-deposit (the user keeps it as a wallet asset).
927
+ * 4. Merge all collected USDC handles via `tx.mergeCoins`, then deposit
928
+ * via `addSaveToTx`.
929
+ *
930
+ * **Atomicity.** Single PTB = single transaction = single sponsored-gas
931
+ * envelope. Either ALL legs settle (claim + swap(s) + deposit) or none
932
+ * do. No partial-state recovery code needed.
933
+ *
934
+ * **Sponsored-gas posture.** This builder appends ONLY chained move
935
+ * calls — no `tx.gas` reads, no Pyth fee writes, no oracle Pyth updates.
936
+ * Cetus chain-mode swaps with `slippage` ≤ 5% don't require Pyth either
937
+ * (Cetus aggregator routes around Pyth-dependent providers when callers
938
+ * pass `providers: getProvidersExcluding(...)`). Audric's host wires
939
+ * the provider exclusion automatically for Enoki sponsorship — see
940
+ * `cetus-swap.ts` JSDoc.
941
+ *
942
+ * **Dust filter.** Rewards with `amount * priceCache.get(symbol) <
943
+ * minRewardUsd` are skipped from the swap leg AND from the deposit —
944
+ * not worth the gas to swap dust. They get transferred back to the
945
+ * wallet (preserving on-chain truth: the claim happened, the swap
946
+ * didn't). Default minRewardUsd = $0.01.
947
+ *
948
+ * **Failure modes.**
949
+ * - PROTOCOL_UNAVAILABLE — NAVI rewards lookup or claim PTB build failed.
950
+ * Engine surfaces "NAVI is degraded right now."
951
+ * - SWAP_NO_ROUTE — a reward asset has no Cetus route. Logged + that
952
+ * leg is skipped (rewards transferred to wallet). Other legs proceed.
953
+ * - INVALID_AMOUNT — rewards array empty after dust filter (nothing
954
+ * worth harvesting). Throws so the engine narrates "nothing to
955
+ * harvest right now" instead of building a no-op PTB.
956
+ *
957
+ * **Why a separate file (not inside `navi.ts`).** This composition
958
+ * crosses two protocols (NAVI + Cetus) — keeping it out of `navi.ts`
959
+ * preserves the single-protocol-per-file invariant the rest of the SDK
960
+ * follows. Mirrors how `cetus-swap.ts` already lives separately even
961
+ * though it composes through `composeTx.ts`.
962
+ */
963
+
964
+ interface HarvestSwapLeg {
965
+ /** Reward symbol pre-swap (e.g. 'vSUI', 'NAVX'). */
966
+ fromSymbol: string;
967
+ /** Reward coinType pre-swap. */
968
+ fromCoinType: string;
969
+ /** Always 'USDC' — this builder only deposits to the USDC pool. */
970
+ toSymbol: 'USDC';
971
+ /** Display-units input amount (the entire claimed reward for that coin). */
972
+ inputAmount: number;
973
+ /** Display-units USDC the swap quote estimated. Actual on-chain may differ within slippage. */
974
+ expectedOutputUsdc: number;
975
+ }
976
+ interface HarvestSkippedLeg {
977
+ /** Reward symbol skipped (untradeable, dust, or no-route). */
978
+ symbol: string;
979
+ coinType: string;
980
+ /** Display-units claimed amount (still credited to user's wallet — just not auto-deposited). */
981
+ amount: number;
982
+ /** 'untradeable' | 'dust' | 'no-route' */
983
+ reason: 'untradeable' | 'dust' | 'no-route';
984
+ }
985
+ interface HarvestPlan {
986
+ /** Every reward that WILL be claimed by this PTB. */
987
+ claimed: PendingReward$1[];
988
+ /** Each non-USDC reward that WILL be swapped to USDC inline. */
989
+ swaps: HarvestSwapLeg[];
990
+ /** Rewards claimed but transferred back to wallet (no auto-deposit). */
991
+ skipped: HarvestSkippedLeg[];
992
+ /** Display-units USDC that will be deposited to the NAVI USDC pool. */
993
+ expectedUsdcDeposited: number;
994
+ }
995
+ interface BuildHarvestRewardsTxOptions {
996
+ /** Per-swap slippage tolerance (0.001–0.05). Defaults to 0.01 (1%). */
997
+ slippage?: number;
998
+ /**
999
+ * USD floor for "is this worth swapping?". Rewards below this threshold
1000
+ * get transferred back to the wallet instead of swapped. Default $0.01.
1001
+ * Pass 0 to disable the filter (always swap; useful for tests).
1002
+ */
1003
+ minRewardUsd?: number;
1004
+ /**
1005
+ * Symbol → USD price map. Sourced from the engine's `ToolContext.priceCache`
1006
+ * in production; tests can pass a literal Map. When undefined, the dust
1007
+ * filter degrades to "skip nothing" (every reward is swapped) so we don't
1008
+ * accidentally drop large rewards just because we couldn't price them.
1009
+ */
1010
+ priceCache?: Map<string, number>;
1011
+ /**
1012
+ * Cetus provider allow-list. Sponsored callers (Enoki) pass
1013
+ * `getProvidersExcluding(['pyth-dependent-list'])` to keep the PTB
1014
+ * Pyth-free. Non-sponsored callers omit this.
1015
+ */
1016
+ providers?: string[];
1017
+ }
1018
+ /**
1019
+ * Standalone harvest builder — creates a fresh PTB, sets the sender,
1020
+ * appends the full harvest flow, and returns both the tx and the plan.
1021
+ * Used by CLI / direct SDK callers (smoke tests, scripts). The audric
1022
+ * host goes through `composeTx({ steps: [{ toolName: 'harvest_rewards' }] })`
1023
+ * which wires the appender + Enoki sponsorship.
1024
+ */
1025
+ declare function buildHarvestRewardsTx(client: SuiJsonRpcClient, address: string, options?: BuildHarvestRewardsTxOptions): Promise<{
1026
+ tx: Transaction;
1027
+ plan: HarvestPlan;
1028
+ }>;
1029
+
842
1030
  declare function getSwapQuote(params: {
843
1031
  walletAddress: string;
844
1032
  from: string;
@@ -1076,4 +1264,4 @@ declare function fullHandle(label: string): string;
1076
1264
  */
1077
1265
  declare function displayHandle(label: string): string;
1078
1266
 
1079
- export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BorrowInput, BorrowResult, type BuildAddLeafParams, 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, HealthFactorResult, type LabelValidationResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, StakeVSuiResult, type StepPreview, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStakeInput, type VoloStats, type VoloUnstakeInput, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addClaimRewardsToTx, addSendToTx, addStakeVSuiToTx, addUnstakeVSuiToTx, aggregateClaimableRewards, buildAddLeafTx, buildClaimRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildUnstakeVSuiTx, composeTx, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fetchAllCoins, fullHandle, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, selectAndSplitCoin, selectSuiCoin, validateLabel, walletExists };
1267
+ 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, type LabelValidationResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, StakeVSuiResult, type StepPreview, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStakeInput, type VoloStats, type VoloUnstakeInput, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addClaimRewardsToTx, addSendToTx, addStakeVSuiToTx, addUnstakeVSuiToTx, aggregateClaimableRewards, buildAddLeafTx, buildClaimRewardsTx, buildHarvestRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildUnstakeVSuiTx, composeTx, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fetchAllCoins, fullHandle, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getPendingRewardsByAddress, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, selectAndSplitCoin, selectSuiCoin, validateLabel, walletExists };