Skip to content

feat(cli): add minimal recognized-usage seller commands - #986

Open
alexanderludwig wants to merge 3 commits into
contracts-update-allfrom
feat/cli-recognized-usage
Open

feat(cli): add minimal recognized-usage seller commands#986
alexanderludwig wants to merge 3 commits into
contracts-update-allfrom
feat/cli-recognized-usage

Conversation

@alexanderludwig

@alexanderludwig alexanderludwig commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add registry-verified CLI integration for the M001 recognized-usage upgrade.
  • Make seller stake ANTS-only, with an explicit lock duration. It never switches to USDC based on the network. Legacy USDC staking, withdrawal, and the migration starter claim live under seller legacy.
  • Keep identity binding explicit in seller register. ANTS staking uses the verified binding and no longer accepts an identity override.
  • Expose one seller rewards interface: seller rewards [claim]. Reads include legacy, recognized-usage, and pool earnings without transactions; claims collect all eligible rewards into the current wallet.
  • Remove redundant aliases, specialized seller/pool reward commands, and the network contracts inspection command. Automatic registry/address validation remains inside payment commands.
  • Preserve withdrawal consent, precise slashing estimates, pagination, withdrawn-position reward discovery, bounded claim preparation, and actual-receipt payout reporting.
  • Keep blockchain logic in the existing @antseed/node/payments SDK clients, not CLI-specific wrappers. Remove the CLI’s direct ethers dependency; retain command parsing, output, instructions, and confirmations in the CLI.

Dependency and scope

Stacked on #968 (contracts-update-all). Merge the prerequisite first, then retarget this PR to main.

The comparison against the base contains no Solidity source changes. It includes the CLI/SDK integration, minimal seller UX, documentation, and fork tests. The SDK now owns the existing on-chain slashing getter and shared payment logic. The pre-existing local Solidity-interface edit remains uncommitted and excluded. No new contract selectors or deployments are required by this SDK cleanup.

SDK ownership

  • Extend the existing seller registry, seller pools, pool rewards, and ANTS token clients; remove the CLI-only subclasses.
  • Reuse explicit/idempotent registration verification, active/withdrawn position discovery, reward preview math, bounded claim orchestration, slashing estimates, and actual receipt totals through SDK APIs.
  • Preview all requested pool positions at one block with operation-scoped caching. Subsequent calls obtain a fresh snapshot instead of keeping stale state for the lifetime of a reused client.
  • Keep reward views read-only. Pool indexing remains part of the explicit claim action only.
  • Move 17 blockchain/calculation tests from CLI to SDK and add five SDK regressions. CLI tests continue to cover output/progress, configuration, command minimalism, and withdrawal UX. The M001 E2E now imports the public SDK client rather than private CLI source.
  • No new CLI commands or flags.

Payment command reference

These are the new or updated seller payment commands; existing seller start/setup/status/doctor commands remain available.

Command Purpose
antseed seller register [--agent-id <id>] [--metadata <uri>] Register identity and explicitly verify/bind it for recognized usage. Repeating an already-complete registration sends no transaction.
antseed seller stake <ants> --epochs <n> Stake ANTS only. Requires M001 and a verified seller binding. On older networks, stops without a transaction and directs the user to legacy USDC staking.
antseed seller rewards [--json] Read aggregate seller rewards, including unindexed earnings and rewards from withdrawn positions. No claim, gas, or on-chain accounting update is required to view earnings.
antseed seller rewards claim Prepare pool accounting when necessary and claim all eligible seller rewards into the current wallet. Reports confirmed transactions and actual received ANTS.
antseed seller pool positions [--json] List the wallet's seller-pool positions and their state.
antseed seller pool withdraw <ids...> [--accept-slashing] [-y, --yes] Withdraw one or more ANTS positions. Early exits require explicit slashing consent and confirmation.
antseed seller legacy stake <usdc> [--agent-id <id>] Stake USDC before M001. New legacy stakes are rejected after the upgrade.
antseed seller legacy unstake Withdraw legacy USDC stake, including after the upgrade.
antseed seller legacy claim-starter Claim the starter ANTS position for an eligible legacy seller after the upgrade.

seller status [--json] includes upgrade-aware identity, stake, eligibility, and position-count information. Buyer emissions retain their existing info / claim commands and --legacy-only / --new-only filters.

Intentional compatibility breaks

Removed command or behavior Replacement
USDC fallback in seller stake seller legacy stake
seller stake --agent-id Select/bind the identity through seller register --agent-id, then stake without an identity override
seller unstake seller legacy unstake
seller pool claim-starter, seller pool bootstrap, seller pool init seller legacy claim-starter; no aliases
seller emissions info, seller pool rewards seller rewards
seller emissions claim, seller pool rewards claim seller rewards claim
network contracts No replacement command; contract validation remains automatic

Seller reward claims no longer expose era filters, per-position selection, or alternate recipients. The canonical command claims all eligible seller earnings into the current wallet. Buyer commands are unchanged by this simplification.

Safety behavior

  • Removed commands and options fail rather than silently redirecting or submitting transactions.
  • On an older network, ANTS staking fails with guidance to seller legacy stake; it never treats an ANTS amount as USDC.
  • Reward views do not mutate account nonce, token balance, or reward-index cursors. The current epoch is excluded.
  • --yes does not replace --accept-slashing. Slashing is determined by the existing contracts at execution; the displayed estimate is not a guaranteed maximum loss.
  • Claim failures report already-confirmed transactions so retries can collect the remainder without hiding partial success.

Validation

  • CLI build/typecheck and 496 passing CLI tests, including command/option rejection and unchanged buyer-command coverage.
  • Fresh M001 fork E2E passed (one expanded end-to-end test, 236 seconds after the SDK cleanup): legacy registration/staking, no USDC fallback, removed-command rejection without nonce changes, explicit/idempotent binding, starter positions, ANTS activation, preserved eligibility after legacy withdrawal, nonzero read-only reward previews, exclusion of the current epoch, exact token-unit payouts, repeat-claim idempotency, withdrawal consent, withdrawn-position rewards, and internal contract-mismatch rejection for both reads and claims.
  • Node SDK: 1,050 tests passed, build and typecheck pass; buyer-core: 11 passed. These suites were rerun after the SDK cleanup. CLI test count dropped by 17 because those tests now live in the SDK, not because coverage was removed.
  • git diff --check.

Fork tests use unchanged M001 contracts on an isolated local Base-mainnet fork. Usage is seeded through the authorized recorder; this is CLI-to-contract integration coverage, not production testing or a complete buyer-to-model inference session. No production transactions are sent.

Local M001 rehearsal helpers

These are repository development helpers, not additional installed antseed commands. Each accepts --out <directory>.

Command Purpose
pnpm m001:sandbox up [--port <port>] Start a persistent fork and deploy M001 to its pre-cutover state. Requires BASE_MAINNET_RPC_URL.
pnpm m001:sandbox cutover Advance the local fork to cutover and activate M001.
pnpm m001:sandbox advance-epoch [n] Advance the local fork by one or more epochs.
pnpm m001:sandbox fund-seller <address> Fund a local seller with USDC and ETH.
pnpm m001:sandbox fund-ants <address> <amount> Fund a local wallet with ANTS from ANTS_HOLDER.
pnpm m001:sandbox fund-position-init <count> Fund starter positions using ANTS_HOLDER.
pnpm m001:sandbox status Inspect the sandbox and registry pointers.
pnpm m001:sandbox down Stop the sandbox.

Documentation

Updates the changelog, CLI and SDK READMEs, website command/provider/payment guides, setup next steps, and M001 CLI rehearsal instructions. The SDK README documents the shared APIs, read-only preview snapshots, receipt reporting, and RPC requirements. Removed commands are listed only in migration notes, not as supported aliases.

@alexanderludwig alexanderludwig changed the title feat(cli): support recognized-usage staking and aggregate seller rewards feat(cli): add minimal recognized-usage seller commands Sep 5, 2026
@alexanderludwig
alexanderludwig force-pushed the feat/cli-recognized-usage branch from adac29e to 0c3a808 Compare September 5, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant