Adds a one-shot operational tx that re-shapes any operator wallet to
{5 AP3X collateral candidate, working remainder} so subsequent Plutus
script-spends (Claim/Submit/Accept/Reclaim/RetireAdvert) find a UTxO
that satisfies lucid's setCollateral=5_000_000n default coin selector.
Symptom this addresses: open-webui mainnet supplier wallet held 8 UTxOs
max 2.40 AP3X, every Accept tx failed at lucid .complete() with the
"wallet must hold a pure-ADA UTxO ≥ 5 ADA" error path. Same fragmentation
risk on the other 4 mainnet operator wallets (one big UTxO surrounded by
dust — first script-spend consumes the big one and leaves nothing usable
as collateral).
Phase 1 — new tx:consolidate-wallet CLI (supplier + buyer):
- planConsolidate.ts — pure planner; supports consolidate (N>1 → 2),
split (1 → 2), and already-healthy skip.
- consolidateWallet.ts — live builder; presetWalletInputs pins all
UTxOs, two pay.ToAddress outputs (collateral + working).
- runConsolidateWallet.ts — orchestration (build + submit + awaitTx).
- supplier/src/cli/consolidate-wallet.ts + buyer mirror.
- monitor-wallets.ts — add supplier-tts@vector-marketplace (was
misclassified as 3rd-party).
Phase 2 — defensive pre-check in the 5 script-spend builders:
- assertCollateralCandidate(utxos) fires at the top of
buildSpendOpenOrClaimedTx (Claim/Submit), buildLiveTxForAccept,
buildLiveTxForReclaim, buildLiveTxForRetireAdvert. Throws a
TxConstructionError("collateral_required") pointing at
tx:consolidate-wallet instead of waiting for lucid's deep failure.
Tests: 12 new passing (planConsolidate edge cases + assert helper).
Pre-existing lucid 0.4.30 WASM "unreachable" failures in tx-*-live.test.ts
fixtures are unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.3 KiB
JSON
44 lines
1.3 KiB
JSON
{
|
|
"name": "@marketplace/buyer",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"typecheck": "tsc --noEmit",
|
|
"build:ui": "vite build --config vite.config.ts",
|
|
"dev:ui": "vite --config vite.config.ts",
|
|
"start": "node --enable-source-maps dist/index.js",
|
|
"tx:accept": "tsx src/cli/accept.ts",
|
|
"cycle:once": "tsx src/cli/run-cycle.ts",
|
|
"reclaim:orphans": "tsx src/cli/reclaim-orphans.ts",
|
|
"monitor:wallets": "tsx scripts/monitor-wallets.ts",
|
|
"tx:consolidate-wallet": "tsx src/cli/consolidate-wallet.ts"
|
|
},
|
|
"dependencies": {
|
|
"@marketplace/shared": "workspace:*",
|
|
"@noble/ed25519": "^2.3.0",
|
|
"@noble/hashes": "^1.8.0",
|
|
"bech32": "^2.0.0",
|
|
"better-sqlite3": "^11.9.1",
|
|
"express": "^4.21.2",
|
|
"react": "^18.3.1",
|
|
"react-dom": "^18.3.1",
|
|
"react-router-dom": "^6.26.0"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/jest-dom": "^6.4.0",
|
|
"@testing-library/react": "^16.0.0",
|
|
"@testing-library/user-event": "^14.5.2",
|
|
"@types/better-sqlite3": "^7.6.12",
|
|
"@types/express": "^5.0.3",
|
|
"@types/react": "^18.3.0",
|
|
"@types/react-dom": "^18.3.0",
|
|
"@vitejs/plugin-react": "^4.3.0",
|
|
"happy-dom": "^15.7.4",
|
|
"supertest": "^7.0.0",
|
|
"tailwindcss": "^3.4.0",
|
|
"typescript": "^5.7.2",
|
|
"vite": "^5.4.0"
|
|
}
|
|
}
|