5
5
"encoding/json"
6
6
"errors"
7
7
"fmt"
8
+ "io"
8
9
"math/big"
9
10
"net/http"
10
11
"sort"
@@ -74,6 +75,7 @@ func getClaimFlags() []cli.Flag {
74
75
& ClaimTimestampFlag ,
75
76
& ProofStoreBaseURLFlag ,
76
77
& flags .VerboseFlag ,
78
+ & SilentFlag ,
77
79
}
78
80
79
81
allFlags := append (baseFlags , flags .GetSignerFlags ()... )
@@ -85,6 +87,10 @@ func Claim(cCtx *cli.Context, p utils.Prompter) error {
85
87
ctx := cCtx .Context
86
88
logger := common .GetLogger (cCtx )
87
89
90
+ if cCtx .Bool (SilentFlag .Name ) {
91
+ logger = logging .NewTextSLogger (io .Discard , nil )
92
+ }
93
+
88
94
config , err := readAndValidateClaimConfig (cCtx , logger )
89
95
if err != nil {
90
96
return eigenSdkUtils .WrapError ("failed to read and validate claim config" , err )
@@ -229,7 +235,7 @@ func Claim(cCtx *cli.Context, p utils.Prompter) error {
229
235
solidityClaim := claimgen .FormatProofForSolidity (accounts .Root (), claim )
230
236
jsonData , err := json .MarshalIndent (solidityClaim , "" , " " )
231
237
if err != nil {
232
- fmt . Println ("Error marshaling JSON:" , err )
238
+ logger . Error ("Error marshaling JSON:" , err )
233
239
return err
234
240
}
235
241
if ! common .IsEmptyString (config .Output ) {
@@ -240,24 +246,24 @@ func Claim(cCtx *cli.Context, p utils.Prompter) error {
240
246
logger .Infof ("Claim written to file: %s" , config .Output )
241
247
} else {
242
248
fmt .Println (string (jsonData ))
243
- fmt .Println ()
244
- fmt .Println ("To write to a file, use the --output flag" )
249
+ logger .Info ("To write to a file, use the --output flag" )
245
250
}
246
251
} else {
247
252
if ! common .IsEmptyString (config .Output ) {
248
- fmt .Println ("output file not supported for pretty output type" )
249
- fmt .Println ()
253
+ logger .Info ("output file not supported for pretty output type" )
250
254
}
251
255
solidityClaim := claimgen .FormatProofForSolidity (accounts .Root (), claim )
252
- fmt . Println ("------- Claim generated -------" )
256
+ logger . Info ("------- Claim generated -------" )
253
257
common .PrettyPrintStruct (* solidityClaim )
254
- fmt .Println ("-------------------------------" )
255
- fmt .Println ("To write to a file, use the --output flag" )
258
+ logger .Info ("-------------------------------" )
259
+ logger .Info ("To write to a file, use the --output flag" )
260
+ }
261
+ if ! cCtx .Bool (SilentFlag .Name ) {
262
+ txFeeDetails := common .GetTxFeeDetails (unsignedTx )
263
+ logger .Info ("\n " )
264
+ txFeeDetails .Print ()
256
265
}
257
- txFeeDetails := common .GetTxFeeDetails (unsignedTx )
258
- fmt .Println ()
259
- txFeeDetails .Print ()
260
- fmt .Println ("To broadcast the claim, use the --broadcast flag" )
266
+ logger .Info ("To broadcast the claim, use the --broadcast flag" )
261
267
}
262
268
263
269
return nil
0 commit comments