aiken-lang / aiken

A modern smart contract platform for Cardano
https://aiken-lang.org
Apache License 2.0
396 stars 82 forks source link

join the dots of the cli #913

Closed waalge closed 2 months ago

waalge commented 3 months ago

Working off v1.0.26-alpha+4f99c81, aiken export is not working. Possibly not yet implemented?... but I guess y'all know that.

Bit of joining the dots between the cli functionality. I want to access aiken uplc eval functionality without having to do cat output.json | jq ' .compiledCode' > output.hex

aiken export --module my_mod --name my_func > output.json
aiken export eval output.json -- "(con integer 3)" 

or whatever.

Also add the same flags to export as build, eg --uplc

KtorZ commented 3 months ago

Honestly, I think that the current situation:

aiken eval $(aiken export --module my_mod --name my_fund | jq '.compiledCode') foo

is perfectly reasonable and does not need further support from the CLI, no? Making the CLI more complex for the sake of removing some rather straightforward utility doesn't look like a good trade-offs to me 😅

waalge commented 3 months ago

In this spirit aiken blueprints should not exist

KtorZ commented 3 months ago

Well, no. This is the trade-off. Having "blueprint address/policy/hash" is relatively easy and necessary as the computing those hashes is complicated (requires knowing serialization, which tag to applies, which hashing algorithm, etc..). Convert is debatable but kind of similar, it requires specific knowledge about an undocumented format (the 'text envelope' from cardano-cli).

But here, you are really asking for passing output of one command to another 😅 ... I see where you're coming from, but I am not sure that the added value balances the complexity trade-off of supporting both modes of operation. Now, if you're down for implementing it and have eval accept either an inline argument or a file, then, possibly.

waalge commented 3 months ago

Originally the issue title was gonna be "aiken export --uplc" since this would sensibly align the behaviour of build and export. The trace flags have just been added to match. But i broadened it. export is new. With some thought perhaps we can join the dots between the cli commands without extra jq glue. There are probably other behaviours that could align with aiken tx although I've still no clue how to interface with that.

Ummm. My previous attempts at modifying aiken has been a bit of dumpster fire (eg outputing json rather than pretty print). Maybe when there are ADRs, I'll put my hand up.