Skip to content

fix: update datum format to include nameserver #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions scripts/create-test-data/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const generate = new Command()
.description("Generate an unsigned TX with the test domain data")
.env("MAESTRO_API_KEY=<value:string>", "Maestro API key", { required: true })
.option("-D, --domain <domain>", "Domain to create test data for", { required: true })
.option("-n, --nameserver <nameserver>", "Nameserver for domain (can be specified multiple times)", { collect: true, required: true })
.option("-n, --nameserver <nameserver>", "Nameserver for domain, specified as a <hostname,ipaddress> pair (can be specified multiple times)", { collect: true, required: true })
.option("-s, --source-address <address>", "Source wallet address to send from (you must be able to sign transactions for this)", { required: true })
.option("-d, --dest-address <address>", "Destination wallet address to send to (this will be read by cdnsd)", { required: true })
.action(async ({ maestroApiKey, domain, nameserver, sourceAddress, destAddress }) => {
Expand All @@ -33,11 +33,22 @@ const generate = new Command()
// TODO: update datum format
const outDatum = new Constr(0, [
fromText(domain),
new Constr(0, nameserver.map(nameserver => fromText(nameserver))),
// [ Constr(0, ...), Constr(0, ...), ... ]
nameserver.map(
nameserver => new Constr(
0,
// Split nameserver hostname and IP address and convert both to bytestrings
nameserver.split(",").map(
nameserver => fromText(nameserver),
),
),
),
]);

const outDatumEncoded = Data.to(outDatum);

//console.log(`outDatumEncoded = ${outDatumEncoded}`)

try {
const txOut = await lucid
.newTx()
Expand Down