fix: correct README examples, signer doc.go, and Validate nil checks#22
Open
giwaov wants to merge 1 commit intotempoxyz:mainfrom
Open
fix: correct README examples, signer doc.go, and Validate nil checks#22giwaov wants to merge 1 commit intotempoxyz:mainfrom
giwaov wants to merge 1 commit intotempoxyz:mainfrom
Conversation
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()`
7dbc474 to
1908a0a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
client.New()returns a single value (not a tuple),SendTransaction(tx)doesn't exist (must useSerialize()+SendRawTransaction()), andhash.Hex()is called on astringsigner/doc.goexample —Sign()takescommon.Hash, not[]byte; the example should useSignData()insteadValidate()forMaxFeePerGasandMaxPriorityFeePerGas— prevents nil pointer panics inClone()andSerialize()keychainpackage to the Packages documentation tableDetailed Changes
README.md
c, _ := client.New(...)won't compile —New()returns*Clientc := client.New(...)c.SendTransaction(tx)doesn't existtransaction.Serialize(tx, nil)+c.SendRawTransaction(ctx, serialized)hash.Hex()called onstringhash(already a string)contextimport"context"RpcUrlMainnetRpcUrlModerato(testnet example)client.SendTransaction(tx)Serialize+SendRawTransactionpatternkeychainpackagepkg/signer/doc.go
signer.Sign(data)wheredatais[]byte→signer.SignData(data)(correct method for[]byteinput)pkg/transaction/transaction.go
MaxFeePerGasandMaxPriorityFeePerGasinValidate(), matching the existing pattern forChainIDandNonceKeynil checksTest plan
go buildValidate()returns error for nilMaxFeePerGas/MaxPriorityFeePerGasmake testgo doc github.com/tempoxyz/tempo-go/pkg/signershows correct example