File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,27 +7,40 @@ spinner.setSpinnerString(19);
77
88module . exports = {
99 prompt : async ( env ) => {
10-
1110 helpers . killForNoConf ( ) ;
12- if ( ! env . file && ! env . text ) helpers . errorExit ( "Must supply either -f <file> or -t <text> param." ) ;
13- if ( env . file && env . text ) helpers . errorExit ( "Cannot supply both -f <file> and -t <text> params." ) ;
11+ if ( ! env . file && ! env . text )
12+ helpers . errorExit ( "Must supply either -f <file> or -t <text> param." ) ;
13+ if ( env . file && env . text )
14+ helpers . errorExit ( "Cannot supply both -f <file> and -t <text> params." ) ;
1415 const bitfact = new BitFact ( helpers . loadConfFile ( ) ) ;
1516
1617 if ( env . file ) {
1718 // bitfact stamp file.
19+
1820 spinner . start ( ) ;
19- const stamped = await bitfact . stampFile ( env . file , env . memo ) ;
21+
22+ try {
23+ const stamped = await bitfact . stampFile ( env . file , env . memo ) ;
24+ helpers . stampDone ( stamped . hash , stamped . txid ) ;
25+ } catch ( e ) {
26+ helpers . errorExit ( e ) ;
27+ }
28+
2029 spinner . stop ( ) ;
21- helpers . stampDone ( stamped . hash , stamped . txid ) ;
2230 }
2331
2432 if ( env . text ) {
2533 // bitfact stamp text
2634 spinner . start ( ) ;
27- const stamped = await bitfact . stampText ( env . text , env . memo ) ;
35+
36+ try {
37+ const stamped = await bitfact . stampText ( env . text , env . memo ) ;
38+ helpers . stampDone ( stamped . hash , stamped . txid ) ;
39+ } catch ( e ) {
40+ helpers . errorExit ( e ) ;
41+ }
42+
2843 spinner . stop ( ) ;
29- helpers . stampDone ( stamped . hash , stamped . txid ) ;
3044 }
31-
3245 } ,
3346} ;
Original file line number Diff line number Diff line change @@ -7,27 +7,38 @@ spinner.setSpinnerString(19);
77
88module . exports = {
99 prompt : async ( env ) => {
10-
1110 helpers . killForNoConf ( ) ;
12- if ( ! env . file && ! env . text ) helpers . errorExit ( "Must supply either -f <file> or -t <text> param." ) ;
13- if ( env . file && env . text ) helpers . errorExit ( "Cannot supply both -f <file> and -t <text> params." ) ;
11+ if ( ! env . file && ! env . text )
12+ helpers . errorExit ( "Must supply either -f <file> or -t <text> param." ) ;
13+ if ( env . file && env . text )
14+ helpers . errorExit ( "Cannot supply both -f <file> and -t <text> params." ) ;
1415 const bitfact = new BitFact ( helpers . loadConfFile ( ) ) ;
15-
16+
1617 if ( env . file ) {
17- // bitfact stamp file.
18+ // bitfact verify file.
1819 spinner . start ( ) ;
19- const isStamped = await bitfact . verifyFile ( env . file , env . tx ) ;
20+
21+ try {
22+ const isStamped = await bitfact . verifyFile ( env . file , env . tx ) ;
23+ helpers . verifyDone ( isStamped ) ;
24+ } catch ( e ) {
25+ helpers . errorExit ( e ) ;
26+ }
27+
2028 spinner . stop ( ) ;
21- helpers . verifyDone ( isStamped ) ;
2229 }
2330
2431 if ( env . text ) {
25- // bitfact stamp text
32+ // bitfact verify text
2633 spinner . start ( ) ;
27- const isStamped = await bitfact . verifyText ( env . text , env . tx ) ;
34+
35+ try {
36+ const isStamped = await bitfact . verifyText ( env . text , env . tx ) ;
37+ helpers . verifyDone ( isStamped ) ;
38+ } catch ( e ) {
39+ helpers . errorExit ( e ) ;
40+ }
2841 spinner . stop ( ) ;
29- helpers . verifyDone ( isStamped ) ;
3042 }
31-
3243 } ,
3344} ;
Original file line number Diff line number Diff line change @@ -28,15 +28,15 @@ const killForNoConf = () => {
2828const stampDone = ( hash , txid ) => {
2929 if ( ! hash || ! txid ) errorExit ( "Could not write to Blockchain." ) ;
3030 console . log ( "" ) ;
31- console . log ( chalk . green ( chalk . bold ( "Success! Stamped on Blockchain." ) ) ) ;
31+ console . log ( chalk . green ( chalk . bold ( "🛡️ Success! Stamped on Blockchain." ) ) ) ;
3232 console . log ( "Hash: " + chalk . gray ( chalk . bold ( hash ) ) ) ;
3333 console . log ( "Txid: " + chalk . gray ( chalk . bold ( txid ) ) ) ;
3434} ;
3535
3636const verifyDone = ( status ) => {
3737 if ( status === undefined ) errorExit ( "Could not read from Blockchain." ) ;
3838 console . log ( "" ) ;
39- console . log ( chalk . gray ( chalk . bold ( "Response received from Blockchain." ) ) ) ;
39+ console . log ( chalk . gray ( chalk . bold ( "🛡️ Response received from Blockchain." ) ) ) ;
4040 console . log (
4141 "Stamped: " + chalk . bold ( status ? chalk . green ( "YES" ) : chalk . red ( "NO" ) )
4242 ) ;
You can’t perform that action at this time.
0 commit comments