@@ -12,19 +12,52 @@ import { fileReader, jsonFileReader, jsonFileWriter } from './utils/file-utils';
12
12
import * as cbor from 'borc' ;
13
13
import { toOutputScript } from 'bitcoinjs-lib/src/address' ;
14
14
import { compactIdToOutpoint , outpointToCompactId } from './utils/atomical-format-helpers' ;
15
+ import * as quotes from 'success-motivational-quotes' ;
16
+ import * as chalk from 'chalk' ;
17
+
15
18
dotenv . config ( ) ;
16
19
17
20
/////////////////////////////////////////////////////////////////////////////////////////////
18
21
// General Helper Functions
19
22
/////////////////////////////////////////////////////////////////////////////////////////////
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 ) {
21
54
console . log ( JSON . stringify ( data , null , 2 ) ) ;
22
55
}
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 ) ;
26
59
} else {
27
- printOperationResult ( result . data ) ;
60
+ printSuccess ( result . data , showDonation ) ;
28
61
}
29
62
}
30
63
@@ -1022,7 +1055,7 @@ program.command('mint-item')
1022
1055
bitworkr : options . bitworkr ,
1023
1056
disableMiningChalk : options . disablechalk ,
1024
1057
} , containerName , itemName , manifestFile , initialOwnerAddress . address , fundingRecord . WIF , ownerWalletRecord ) ;
1025
- handleResultLogging ( result ) ;
1058
+ handleResultLogging ( result , true ) ;
1026
1059
} catch ( error ) {
1027
1060
console . log ( error ) ;
1028
1061
}
@@ -1171,6 +1204,7 @@ program.command('splat')
1171
1204
}
1172
1205
} ) ;
1173
1206
1207
+ /*
1174
1208
program.command('split')
1175
1209
.description('Split operation to separate the FT Atomicals at a single UTXOs.')
1176
1210
.argument('<locationId>', 'string')
@@ -1194,6 +1228,7 @@ program.command('split')
1194
1228
console.log(error);
1195
1229
}
1196
1230
});
1231
+ */
1197
1232
1198
1233
program . command ( 'get' )
1199
1234
. description ( 'Get the status of an Atomical' )
@@ -1206,7 +1241,7 @@ program.command('get')
1206
1241
const atomicals = new Atomicals ( ElectrumApi . createClient ( process . env . ELECTRUMX_PROXY_BASE_URL || '' ) ) ;
1207
1242
const verbose = options . verbose ? true : false ;
1208
1243
const result = await atomicals . resolveAtomical ( atomicalAliasOrId , AtomicalsGetFetchType . GET , undefined , verbose ) ;
1209
- handleResultLogging ( result ) ;
1244
+ handleResultLogging ( result , true ) ;
1210
1245
} catch ( error ) {
1211
1246
console . log ( error ) ;
1212
1247
}
@@ -1539,7 +1574,7 @@ program.command('mint-dft')
1539
1574
satsbyte : parseInt ( options . satsbyte ) ,
1540
1575
disableMiningChalk : options . disablechalk ,
1541
1576
} , walletRecord . address , ticker , fundingRecord . WIF ) ;
1542
- handleResultLogging ( result ) ;
1577
+ handleResultLogging ( result , true ) ;
1543
1578
} catch ( error ) {
1544
1579
console . log ( error ) ;
1545
1580
}
@@ -1624,7 +1659,7 @@ program.command('mint-realm')
1624
1659
parentOwner : parentOwnerRecord ,
1625
1660
disableMiningChalk : options . disablechalk ,
1626
1661
} , realm , initialOwnerAddress . address , fundingRecord . WIF ) ;
1627
- handleResultLogging ( result ) ;
1662
+ handleResultLogging ( result , true ) ;
1628
1663
} catch ( error ) {
1629
1664
console . log ( error ) ;
1630
1665
}
0 commit comments