Implement new command: address

This calculates a validator's address from validators found in a blueprint. It also provides a convenient way to attach a delegation part to the validator if needs be. The command is meant to provide a nice user experience and works 'out of the box' for projects that have only a single validator. Just call 'aiken address' to get the validator's address.

  Note that the command-line doesn't provide any option to configure the target network. This automatically assumes testnet, and will until we deem the project ready for mainnet. Those brave enough to run an Aiken's program on mainnet will find a way anyway.
This commit is contained in:
KtorZ
2023-01-31 15:30:52 +01:00
parent 1aa12fb368
commit daee8e39d6
8 changed files with 212 additions and 10 deletions

View File

@@ -27,7 +27,7 @@ pub enum Error {
source_code: NamedSource,
return_type: Arc<Type>,
},
#[error("A {} validator requires at least {at_least} arguments", name.purple().bold())]
#[error("A {} validator requires at least {} arguments.", name.purple().bold(), at_least.to_string().purple().bold())]
#[diagnostic(code("aiken::blueprint::invalid::arity"))]
WrongValidatorArity {
name: String,
@@ -47,6 +47,11 @@ pub enum Error {
#[source_code]
source_code: NamedSource,
},
#[error("Invalid or missing project's blueprint file.")]
#[diagnostic(code("aiken::blueprint::missing"))]
#[diagnostic(help("Did you forget to {build} the project?", build = "build".purple().bold()))]
InvalidOrMissingFile,
}
pub fn assert_return_bool(module: &CheckedModule, def: &TypedFunction) -> Result<(), Error> {