@@ -15,10 +15,23 @@ const generate = new Command()
15
15
. description ( "Generate an unsigned TX with the test domain data" )
16
16
. env ( "MAESTRO_API_KEY=<value:string>" , "Maestro API key" , { required : true } )
17
17
. 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 } )
19
20
. option ( "-s, --source-address <address>" , "Source wallet address to send from (you must be able to sign transactions for this)" , { required : true } )
20
21
. 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
+
22
35
console . log ( `Building transaction...` ) ;
23
36
24
37
const provider = new Maestro ( {
@@ -31,7 +44,7 @@ const generate = new Command()
31
44
lucid . selectWalletFrom ( { address : sourceAddress } ) ;
32
45
33
46
let outDatumRecords = [ ]
34
- record . forEach ( ( tmpRecord ) => {
47
+ records . forEach ( ( tmpRecord ) => {
35
48
const recordParts = tmpRecord . split ( "," )
36
49
if ( recordParts . length == 3 ) {
37
50
outDatumRecords . push ( new Constr (
0 commit comments