Skip to content

Comments

fix: correct README examples, signer doc.go, and Validate nil checks#22

Open
giwaov wants to merge 1 commit intotempoxyz:mainfrom
giwaov:fix/readme-examples-and-docs
Open

fix: correct README examples, signer doc.go, and Validate nil checks#22
giwaov wants to merge 1 commit intotempoxyz:mainfrom
giwaov:fix/readme-examples-and-docs

Conversation

@giwaov
Copy link

@giwaov giwaov commented Feb 20, 2026

Summary

  • Fix 5 non-compiling README code examplesclient.New() returns a single value (not a tuple), SendTransaction(tx) doesn't exist (must use Serialize() + SendRawTransaction()), and hash.Hex() is called on a string
  • Fix signer/doc.go exampleSign() takes common.Hash, not []byte; the example should use SignData() instead
  • Add nil checks in Validate() for MaxFeePerGas and MaxPriorityFeePerGas — prevents nil pointer panics in Clone() and Serialize()
  • Add missing keychain package to the Packages documentation table
  • Fix "crates" → "packages" terminology (Go, not Rust)

Detailed Changes

README.md

Line(s) Issue Fix
Quick Start c, _ := client.New(...) won't compile — New() returns *Client c := client.New(...)
Quick Start c.SendTransaction(tx) doesn't exist transaction.Serialize(tx, nil) + c.SendRawTransaction(ctx, serialized)
Quick Start hash.Hex() called on string hash (already a string)
Quick Start Missing context import Added "context"
Quick Start Uses RpcUrlMainnet Changed to RpcUrlModerato (testnet example)
4 examples client.SendTransaction(tx) Same Serialize + SendRawTransaction pattern
Packages table Missing keychain package Added row
License "crates" (Rust term) "packages" (Go term)

pkg/signer/doc.go

  • signer.Sign(data) where data is []bytesigner.SignData(data) (correct method for []byte input)

pkg/transaction/transaction.go

  • Added nil checks for MaxFeePerGas and MaxPriorityFeePerGas in Validate(), matching the existing pattern for ChainID and NonceKey nil checks

Test plan

  • Verify Quick Start example compiles with go build
  • Verify Validate() returns error for nil MaxFeePerGas/MaxPriorityFeePerGas
  • Run existing test suite: make test
  • Verify go doc github.com/tempoxyz/tempo-go/pkg/signer shows correct example

README.md:
- Fix `client.New()` destructuring: returns `*Client`, not `(*Client, error)`
- Replace non-existent `SendTransaction(tx)` with correct
  `Serialize()` + `SendRawTransaction(ctx, serialized)` pattern (5 occurrences)
- Fix `hash.Hex()` call on string return type (`SendRawTransaction`
  returns `string`, not `common.Hash`)
- Add missing `context` import to Quick Start example
- Use `RpcUrlModerato` (testnet) instead of `RpcUrlMainnet` in Quick Start
- Add missing `keychain` package to the Packages table
- Fix "crates" → "packages" (Go terminology, not Rust)

pkg/signer/doc.go:
- Fix example: `signer.Sign(data)` → `signer.SignData(data)` — `Sign()`
  takes `common.Hash`, not `[]byte`; `SignData()` is the correct method
  for signing arbitrary byte data

pkg/transaction/transaction.go:
- Add nil checks for `MaxFeePerGas` and `MaxPriorityFeePerGas` in
  `Validate()` — without these, `Clone()` and `Serialize()` can panic
  on nil pointer dereference when calling `.Sign()` or `.Cmp()`
@giwaov giwaov force-pushed the fix/readme-examples-and-docs branch from 7dbc474 to 1908a0a Compare February 20, 2026 11:59
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