Skip to content

Port Ethereum transaction management example from v1 to v2 - #149

Merged
truham merged 5 commits into
mainfrom
hamilton/migrate-transaction-management-examples
Sep 9, 2026
Merged

truham merged 5 commits into
mainfrom
hamilton/migrate-transaction-management-examples

Conversation

@truham

@truham truham commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary & Motivation

Ports the Ethereum transaction management example from v1 to v2.

Three actions via ACTION:

  • send (ETH self-transfer)
  • swap (Uniswap V3 ETH → USDC)
  • assets

Sponsored via Gas Station by default, SPONSOR=false for non-sponsored.

Updated to v2 conventions: env vars + .env.example instead of flags, flat request structs, revert-chain error rendering, bounded 60s poll. No new dependencies, the Uniswap calldata is ABI-encoded by hand.

How I Tested These Changes

Ran end to end against Ethereum Sepolia.

Did you add a changeset?

No, examples-only.

truham and others added 3 commits September 8, 2026 16:14
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…xample

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@truham truham left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed via Valet. CI is green and the three issues flagged in an earlier pass have all been addressed:

  • honoured → honored typo fixed.
  • revertEntry cyclomatic complexity resolved by extracting revertDescription.
  • Duplicated magic number (0.0001 ETH literal) collapsed into a single selfTransferWei constant used by both send and swap.

Bonus: padBigInt was upgraded from silent truncation to returning an explicit error on overflow/negative values — good call for calldata that gets signed and broadcast.

A few non-blocking notes below, inline. Nothing here should hold up merge given this is examples-only and was tested end-to-end on Sepolia.

Comment thread examples/transaction_management/ethereum/main.go
Comment thread examples/transaction_management/ethereum/main.go
Comment thread examples/transaction_management/ethereum/main.go
Comment thread examples/transaction_management/ethereum/main.go Outdated
Comment thread examples/transaction_management/ethereum/main.go
truham and others added 2 commits September 9, 2026 14:21
The swap action's SwapRouter02 and token addresses are Ethereum Sepolia-only,
so an overridable TURNKEY_CAIP2 could only ever produce a chain/contract
mismatch. The CAIP-2 chain ID now sits in the same const block as those
addresses, and TURNKEY_CAIP2 is gone from the config, .env.example and README.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A transaction can be included and then revert, reporting both a hash and a
failure. txResult checked the failure first and returned an empty hash, so the
one identifier that lets you look the revert up in an explorer was dropped. The
hash is now read first, returned on both paths, and included in the error text
— the callers surface only the error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@truham
truham merged commit b7c1a5b into main Sep 9, 2026
3 checks passed
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.

2 participants