This repository was archived by the owner on Jun 22, 2023. It is now read-only.
File tree 3 files changed +15
-6
lines changed
3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -512,9 +512,9 @@ func (c *BaseClient) GetOperationQRPath(operationID string) (string, error) {
512
512
return "" , fmt .Errorf ("failed to get operation in JSON: %w" , err )
513
513
}
514
514
515
- operationQRPath := filepath .Join (QrCodesDir , fmt .Sprintf ("dc4bc_qr_ %s" , operationID ))
515
+ operationQRPath := filepath .Join (QrCodesDir , fmt .Sprintf ("dc4bc_json_ %s" , operationID ))
516
516
517
- qrPath := fmt .Sprintf ("%s.gif " , operationQRPath )
517
+ qrPath := fmt .Sprintf ("%s.json " , operationQRPath )
518
518
if err = c .qrProcessor .WriteQR (qrPath , operationJSON ); err != nil {
519
519
return "" , err
520
520
}
Original file line number Diff line number Diff line change 9
9
"encoding/hex"
10
10
"encoding/json"
11
11
"fmt"
12
- "github.com/lidofinance/dc4bc/client/types"
13
12
"io/ioutil"
14
13
"log"
15
14
"net/http"
@@ -20,6 +19,7 @@ import (
20
19
"strings"
21
20
"time"
22
21
22
+ "github.com/lidofinance/dc4bc/client/types"
23
23
"github.com/lidofinance/dc4bc/fsm/state_machines"
24
24
25
25
"github.com/lidofinance/dc4bc/fsm/fsm"
@@ -388,16 +388,16 @@ func getOperationQRPathCommand() *cobra.Command {
388
388
return fmt .Errorf ("failed to get operations: %s" , operation .ErrorMessage )
389
389
}
390
390
391
- operationQRPath := filepath .Join (qrCodeFolder , fmt .Sprintf ("dc4bc_qr_ %s-request" , operationID ))
391
+ operationQRPath := filepath .Join (qrCodeFolder , fmt .Sprintf ("dc4bc_json_ %s-request" , operationID ))
392
392
393
- qrPath := fmt .Sprintf ("%s.gif " , operationQRPath )
393
+ qrPath := fmt .Sprintf ("%s.json " , operationQRPath )
394
394
395
395
processor := qr .NewCameraProcessor ()
396
396
processor .SetChunkSize (chunkSize )
397
397
processor .SetDelay (framesDelay )
398
398
399
399
if err = processor .WriteQR (qrPath , operation .Result ); err != nil {
400
- return fmt .Errorf ("failed to save QR gif : %w" , err )
400
+ return fmt .Errorf ("failed to save json : %w" , err )
401
401
}
402
402
403
403
fmt .Printf ("QR code was saved to: %s\n " , qrPath )
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"image/draw"
11
11
"image/gif"
12
12
"io"
13
+ "io/ioutil"
13
14
"os"
14
15
15
16
encoder "github.com/skip2/go-qrcode"
@@ -71,6 +72,14 @@ func (p *CameraProcessor) SetRecoveryLevel(recoveryLevel encoder.RecoveryLevel)
71
72
}
72
73
73
74
func (p * CameraProcessor ) WriteQR (path string , data []byte ) error {
75
+ err := ioutil .WriteFile (path , data , 0644 )
76
+ if err != nil {
77
+ return fmt .Errorf ("failed to write json: %w" , err )
78
+ }
79
+ return nil
80
+ }
81
+
82
+ func (p * CameraProcessor ) WriteQR_ (path string , data []byte ) error {
74
83
chunks , err := DataToChunks (data , p .chunkSize )
75
84
if err != nil {
76
85
return fmt .Errorf ("failed to divide data on chunks: %w" , err )
You can’t perform that action at this time.
0 commit comments