@@ -15,10 +15,23 @@ const generate = new Command()
1515 . description ( "Generate an unsigned TX with the test domain data" )
1616 . env ( "MAESTRO_API_KEY=<value:string>" , "Maestro API key" , { required : true } )
1717 . option ( "-D, --domain <domain>" , "Domain to create test data for" , { required : true } )
18- . option ( "-r, --record <record>" , "Record for domain, specified as: <name>[,<ttl>],<type>,<value> (can be specified multiple times)" , { collect : true , required : true } )
18+ . option ( "-n, --nameserver <nameserver>" , "Nameserver for domain, specified as: <name>,<ipaddr> (can be specified multiple times)" , { collect : true , required : true } )
19+ . option ( "-r, --record <record>" , "Record for domain, specified as: <name>[,<ttl>],<type>,<value> (can be specified multiple times)" , { collect : true } )
1920 . option ( "-s, --source-address <address>" , "Source wallet address to send from (you must be able to sign transactions for this)" , { required : true } )
2021 . option ( "-d, --dest-address <address>" , "Destination wallet address to send to (this will be read by cdnsd)" , { required : true } )
21- . action ( async ( { maestroApiKey, domain, record, sourceAddress, destAddress } ) => {
22+ . action ( async ( { maestroApiKey, domain, nameserver, record, sourceAddress, destAddress } ) => {
23+ // Merge --nameserver and --record values
24+ let records = [ ]
25+ for ( var tmpNameserver of nameserver ) {
26+ const tmpNameserverParts = tmpNameserver . split ( "," )
27+ // Nameservers for a domain need both a NS record on the domain and an A record for themselves
28+ records . push ( `${ domain } ,ns,${ tmpNameserverParts [ 0 ] } ` )
29+ records . push ( `${ tmpNameserverParts [ 0 ] } ,a,${ tmpNameserverParts [ 1 ] } ` )
30+ }
31+ for ( var tmpRecord in record ) {
32+ records . push ( tmpRecord )
33+ }
34+
2235 console . log ( `Building transaction...` ) ;
2336
2437 const provider = new Maestro ( {
@@ -31,7 +44,7 @@ const generate = new Command()
3144 lucid . selectWalletFrom ( { address : sourceAddress } ) ;
3245
3346 let outDatumRecords = [ ]
34- record . forEach ( ( tmpRecord ) => {
47+ records . forEach ( ( tmpRecord ) => {
3548 const recordParts = tmpRecord . split ( "," )
3649 if ( recordParts . length == 3 ) {
3750 outDatumRecords . push ( new Constr (
0 commit comments