Skip to content

Commit 77aca54

Browse files
authored
Merge pull request #60 from blinklabs-io/feat/test-data-script
fix: update datum format to include nameserver
2 parents b2175c5 + b241091 commit 77aca54

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

scripts/create-test-data/main.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ 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("-n, --nameserver <nameserver>", "Nameserver for domain (can be specified multiple times)", { collect: true, required: true })
18+
.option("-n, --nameserver <nameserver>", "Nameserver for domain, specified as a <hostname,ipaddress> pair (can be specified multiple times)", { collect: true, required: true })
1919
.option("-s, --source-address <address>", "Source wallet address to send from (you must be able to sign transactions for this)", { required: true })
2020
.option("-d, --dest-address <address>", "Destination wallet address to send to (this will be read by cdnsd)", { required: true })
2121
.action(async ({ maestroApiKey, domain, nameserver, sourceAddress, destAddress }) => {
@@ -33,11 +33,22 @@ const generate = new Command()
3333
// TODO: update datum format
3434
const outDatum = new Constr(0, [
3535
fromText(domain),
36-
new Constr(0, nameserver.map(nameserver => fromText(nameserver))),
36+
// [ Constr(0, ...), Constr(0, ...), ... ]
37+
nameserver.map(
38+
nameserver => new Constr(
39+
0,
40+
// Split nameserver hostname and IP address and convert both to bytestrings
41+
nameserver.split(",").map(
42+
nameserver => fromText(nameserver),
43+
),
44+
),
45+
),
3746
]);
3847

3948
const outDatumEncoded = Data.to(outDatum);
4049

50+
//console.log(`outDatumEncoded = ${outDatumEncoded}`)
51+
4152
try {
4253
const txOut = await lucid
4354
.newTx()

0 commit comments

Comments
 (0)