@@ -12,19 +12,52 @@ import { fileReader, jsonFileReader, jsonFileWriter } from './utils/file-utils';
1212import * as cbor from 'borc' ;
1313import { toOutputScript } from 'bitcoinjs-lib/src/address' ;
1414import { compactIdToOutpoint , outpointToCompactId } from './utils/atomical-format-helpers' ;
15+ import * as quotes from 'success-motivational-quotes' ;
16+ import * as chalk from 'chalk' ;
17+
1518dotenv . config ( ) ;
1619
1720/////////////////////////////////////////////////////////////////////////////////////////////
1821// General Helper Functions
1922/////////////////////////////////////////////////////////////////////////////////////////////
20- function printOperationResult ( data : any , error ?: boolean ) {
23+ function printSuccess ( data : any , showDonation ?: boolean ) {
24+ console . log ( JSON . stringify ( data , null , 2 ) ) ;
25+ if ( ! showDonation ) {
26+ return ;
27+ }
28+
29+ if ( process . env . DISABLE_DONATE_QUOTE && process . env . DISABLE_DONATE_QUOTE === 'true' ) {
30+ return ;
31+ }
32+ console . log ( chalk . blue ( "\n\n------------------------------------------------------------------------------" ) ) ;
33+
34+ let q = 'Recommend to your children virtue; that alone can make them happy, not gold.' ;
35+ let by = 'Ludwig van Beethoven' ;
36+ try {
37+ const quoteObj = quotes . getTodaysQuote ( ) ;
38+ q = quoteObj . body ;
39+ by = quoteObj . by ;
40+ } catch ( ex ) {
41+ // Lib not installed
42+ }
43+ console . log ( chalk . green ( q ) ) ;
44+ console . log ( chalk . green ( '- ' + by ) ) ;
45+ console . log ( chalk . blue ( "------------------------------------------------------------------------------\n" ) )
46+ const donate = 'bc1pl6k2z5ra403zfeyevzsu7llh0mdqqn4802p4uqfhz6l7qzddq2mqduqvc6' ;
47+ console . log ( 'Thank you for your support and contributions to Atomicals CLI development! ❤️' ) ;
48+ console . log ( `Donation address: ${ donate } \n` ) ;
49+ console . log ( `Even a little goes a long way!\n` ) ;
50+ console . log ( `Scan QR Code to Donate:` ) ;
51+ qrcode . generate ( donate , { small : true } ) ;
52+ }
53+ function printFailure ( data : any ) {
2154 console . log ( JSON . stringify ( data , null , 2 ) ) ;
2255}
23- function handleResultLogging ( result : any ) {
24- if ( ! result || ! result . success ) {
25- printOperationResult ( result , true ) ;
56+ function handleResultLogging ( result : any , showDonation ?: boolean ) {
57+ if ( ! result || ! result . success || ! result . data ) {
58+ printFailure ( result ) ;
2659 } else {
27- printOperationResult ( result . data ) ;
60+ printSuccess ( result . data , showDonation ) ;
2861 }
2962}
3063
@@ -1022,7 +1055,7 @@ program.command('mint-item')
10221055 bitworkr : options . bitworkr ,
10231056 disableMiningChalk : options . disablechalk ,
10241057 } , containerName , itemName , manifestFile , initialOwnerAddress . address , fundingRecord . WIF , ownerWalletRecord ) ;
1025- handleResultLogging ( result ) ;
1058+ handleResultLogging ( result , true ) ;
10261059 } catch ( error ) {
10271060 console . log ( error ) ;
10281061 }
@@ -1171,6 +1204,7 @@ program.command('splat')
11711204 }
11721205 } ) ;
11731206
1207+ /*
11741208program.command('split')
11751209 .description('Split operation to separate the FT Atomicals at a single UTXOs.')
11761210 .argument('<locationId>', 'string')
@@ -1194,6 +1228,7 @@ program.command('split')
11941228 console.log(error);
11951229 }
11961230 });
1231+ */
11971232
11981233program . command ( 'get' )
11991234 . description ( 'Get the status of an Atomical' )
@@ -1206,7 +1241,7 @@ program.command('get')
12061241 const atomicals = new Atomicals ( ElectrumApi . createClient ( process . env . ELECTRUMX_PROXY_BASE_URL || '' ) ) ;
12071242 const verbose = options . verbose ? true : false ;
12081243 const result = await atomicals . resolveAtomical ( atomicalAliasOrId , AtomicalsGetFetchType . GET , undefined , verbose ) ;
1209- handleResultLogging ( result ) ;
1244+ handleResultLogging ( result , true ) ;
12101245 } catch ( error ) {
12111246 console . log ( error ) ;
12121247 }
@@ -1539,7 +1574,7 @@ program.command('mint-dft')
15391574 satsbyte : parseInt ( options . satsbyte ) ,
15401575 disableMiningChalk : options . disablechalk ,
15411576 } , walletRecord . address , ticker , fundingRecord . WIF ) ;
1542- handleResultLogging ( result ) ;
1577+ handleResultLogging ( result , true ) ;
15431578 } catch ( error ) {
15441579 console . log ( error ) ;
15451580 }
@@ -1624,7 +1659,7 @@ program.command('mint-realm')
16241659 parentOwner : parentOwnerRecord ,
16251660 disableMiningChalk : options . disablechalk ,
16261661 } , realm , initialOwnerAddress . address , fundingRecord . WIF ) ;
1627- handleResultLogging ( result ) ;
1662+ handleResultLogging ( result , true ) ;
16281663 } catch ( error ) {
16291664 console . log ( error ) ;
16301665 }
0 commit comments