@@ -3,6 +3,7 @@ package seth
33import (
44 "context"
55 "crypto/ecdsa"
6+ "errors"
67 "fmt"
78 "math/big"
89 "net/http"
@@ -21,7 +22,6 @@ import (
2122 "github.com/ethereum/go-ethereum/accounts/abi/bind"
2223 "github.com/ethereum/go-ethereum/common"
2324 "github.com/ethereum/go-ethereum/core/types"
24- "github.com/pkg/errors"
2525 "github.com/rs/zerolog"
2626 "golang.org/x/sync/errgroup"
2727)
@@ -89,8 +89,8 @@ func NewClientWithConfig(cfg *Config) (*Client, error) {
8989 initDefaultLogging ()
9090
9191 if cfg == nil {
92- return nil , fmt .Errorf ("Seth configuration is nil. " +
93- "Ensure you're calling NewClientWithConfig() with a valid config, or use NewClient() to load from SETH_CONFIG_PATH environment variable. " +
92+ return nil , fmt .Errorf ("Seth configuration is nil. " +
93+ "Ensure you're calling NewClientWithConfig() with a valid config, or use NewClient() to load from SETH_CONFIG_PATH environment variable. " +
9494 "See documentation for configuration examples" )
9595 }
9696 if cfgErr := cfg .Validate (); cfgErr != nil {
@@ -199,18 +199,18 @@ func NewClientRaw(
199199 opts ... ClientOpt ,
200200) (* Client , error ) {
201201 if cfg == nil {
202- return nil , fmt .Errorf ("Seth configuration is nil. " +
203- "Provide a valid Config when calling NewClientRaw(). " +
202+ return nil , fmt .Errorf ("Seth configuration is nil. " +
203+ "Provide a valid Config when calling NewClientRaw(). " +
204204 "Consider using NewClient() or NewClientWithConfig() instead" )
205205 }
206206 if cfgErr := cfg .Validate (); cfgErr != nil {
207207 return nil , cfgErr
208208 }
209209 if cfg .ReadOnly && (len (addrs ) > 0 || len (pkeys ) > 0 ) {
210- return nil , fmt .Errorf ("configuration conflict: read-only mode is enabled, but private keys were provided. " +
211- "Read-only mode is for querying blockchain state only (no transactions).\n " +
212- "To fix:\n " +
213- " 1. Remove private keys if you only need to read data\n " +
210+ return nil , fmt .Errorf ("configuration conflict: read-only mode is enabled, but private keys were provided. " +
211+ "Read-only mode is for querying blockchain state only (no transactions).\n " +
212+ "To fix:\n " +
213+ " 1. Remove private keys if you only need to read data\n " +
214214 " 2. Set 'read_only = false' in config if you need to send transactions" )
215215 }
216216
@@ -219,7 +219,7 @@ func NewClientRaw(
219219 if cfg .ethclient == nil {
220220 L .Info ().Msg ("Creating new ethereum client" )
221221 if len (cfg .Network .URLs ) == 0 {
222- return nil , fmt .Errorf ("no RPC URLs provided. " +
222+ return nil , fmt .Errorf ("no RPC URLs provided. " +
223223 "Set RPC URLs in your seth.toml config under 'urls_secret = [\" http://...\" ]' or provide via WithRpcUrl() when using ClientBuilder" )
224224 }
225225
@@ -323,9 +323,9 @@ func NewClientRaw(
323323
324324 if cfg .CheckRpcHealthOnStart {
325325 if cfg .ReadOnly {
326- return nil , fmt .Errorf ("RPC health check is not supported in read-only mode because it requires sending transactions. " +
327- "Either:\n " +
328- " 1. Set 'read_only = false' to enable transaction capabilities\n " +
326+ return nil , fmt .Errorf ("RPC health check is not supported in read-only mode because it requires sending transactions. " +
327+ "Either:\n " +
328+ " 1. Set 'read_only = false' to enable transaction capabilities\n " +
329329 " 2. Set 'check_rpc_health_on_start = false' to skip the health check" )
330330 }
331331 if c .NonceManager == nil {
@@ -338,9 +338,9 @@ func NewClientRaw(
338338 }
339339
340340 if cfg .PendingNonceProtectionEnabled && cfg .ReadOnly {
341- return nil , fmt .Errorf ("pending nonce protection is not supported in read-only mode because it requires transaction monitoring. " +
342- "Either:\n " +
343- " 1. Set 'read_only = false' to enable transaction capabilities\n " +
341+ return nil , fmt .Errorf ("pending nonce protection is not supported in read-only mode because it requires transaction monitoring. " +
342+ "Either:\n " +
343+ " 1. Set 'read_only = false' to enable transaction capabilities\n " +
344344 " 2. Set 'pending_nonce_protection_enabled = false'" )
345345 }
346346
@@ -356,14 +356,14 @@ func NewClientRaw(
356356
357357 if cfg .ephemeral {
358358 if len (c .Addresses ) == 0 {
359- return nil , fmt .Errorf ("ephemeral mode requires exactly one root private key to fund ephemeral addresses, but no keys were loaded. " +
360- "Load the root private key via:\n " +
361- " 1. SETH_ROOT_PRIVATE_KEY environment variable\n " +
362- " 2. 'root_private_key' in seth.toml\n " +
359+ return nil , fmt .Errorf ("ephemeral mode requires exactly one root private key to fund ephemeral addresses, but no keys were loaded. " +
360+ "Load the root private key via:\n " +
361+ " 1. SETH_ROOT_PRIVATE_KEY environment variable\n " +
362+ " 2. 'root_private_key' in seth.toml\n " +
363363 " 3. WithPrivateKeys() when using ClientBuilder" )
364364 }
365365 if cfg .ReadOnly {
366- return nil , fmt .Errorf ("ephemeral mode is not supported in read-only mode because it requires funding transactions. " +
366+ return nil , fmt .Errorf ("ephemeral mode is not supported in read-only mode because it requires funding transactions. " +
367367 "Set 'read_only = false' or disable ephemeral mode by removing 'ephemeral_addresses_number' from config" )
368368 }
369369 ctx , cancel := context .WithTimeout (context .Background (), c .Cfg .Network .TxnTimeout .D )
@@ -439,9 +439,9 @@ func NewClientRaw(
439439 }
440440
441441 if c .Cfg .GasBump != nil && c .Cfg .GasBump .Retries != 0 && c .Cfg .ReadOnly {
442- return nil , fmt .Errorf ("gas bumping is not supported in read-only mode because it requires sending replacement transactions. " +
443- "Either:\n " +
444- " 1. Set 'read_only = false' to enable transaction capabilities\n " +
442+ return nil , fmt .Errorf ("gas bumping is not supported in read-only mode because it requires sending replacement transactions. " +
443+ "Either:\n " +
444+ " 1. Set 'read_only = false' to enable transaction capabilities\n " +
445445 " 2. Set 'gas_bump.retries = 0' to disable gas bumping" )
446446 }
447447
@@ -1294,10 +1294,10 @@ type DeploymentData struct {
12941294// name of ABI file (you can omit the .abi suffix).
12951295func (m * Client ) DeployContractFromContractStore (auth * bind.TransactOpts , name string , params ... interface {}) (DeploymentData , error ) {
12961296 if m .ContractStore == nil {
1297- return DeploymentData {}, fmt .Errorf ("contract store is nil. Cannot deploy contract from store.\n " +
1298- "This usually means:\n " +
1299- " 1. Seth client wasn't properly initialized\n " +
1300- " 2. ABI directory path is incorrect in config\n " +
1297+ return DeploymentData {}, fmt .Errorf ("contract store is nil. Cannot deploy contract from store.\n " +
1298+ "This usually means:\n " +
1299+ " 1. Seth client wasn't properly initialized\n " +
1300+ " 2. ABI directory path is incorrect in config\n " +
13011301 "Ensure 'abi_dir' and 'bin_dir' are set in seth.toml or use DeployContract() with explicit ABI/bytecode" )
13021302 }
13031303
0 commit comments