go-livepeer icon indicating copy to clipboard operation
go-livepeer copied to clipboard

feat: show estimated tx cost in confirmation step

Open 597226617 opened this issue 7 months ago • 0 comments

Summary

Implements #1815 - Add estimated transaction cost display and confirmation step before submitting on-chain transactions.

Changes

Server-side

  • New /estimateTxCost endpoint (server/handlers.go): Accepts txType query param, returns estimated gas cost in ETH based on current gas price and typical gas limits per tx type
  • Registered route in server/webserver.go

CLI-side

  • New confirmTx() helper (cmd/livepeer_cli/wizard.go): Queries /estimateTxCost, displays estimated cost, prompts user for y/N confirmation
  • Added confirmation to all transaction wizards:
    • bond, rebond, unbond, withdrawStake, withdrawFees (wizard_bond.go)
    • initializeRound (wizard_rounds.go)
    • activateOrchestrator (wizard_transcoder.go)
    • fundDepositAndReserve, unlock, withdraw (wizard_ticketbroker.go)

ETH Client

  • Added EstimateTransferGas method to eth/client.go interface

User Experience

⚠️  Transaction: Bond 100 tokens to 0x123...
💰 Estimated cost: 0.0015 ETH (gas limit: 150000, gas price: 10000000000 wei)
Do you want to proceed? [y/N]: 

Closes #1815 Relates to #1783

597226617 avatar Apr 29 '26 09:04 597226617