Skip to content

Commit

Permalink
add template parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Oct 5, 2023
1 parent 2244821 commit 821866f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions applications/tari_scaffolder/src/template/src/cli.rs.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub(crate) struct Cli {
pub daemon_jrpc_endpoint: Option<String>,
#[clap(long, short='t', alias= "token")]
pub auth_token: String,
#[clap(long, alias="template_address", default_value ="5d824fb9902af3afa3eefe6b15764ebf336c6b1c6d8438e6efd478b4639d1e36")]
pub template: String,
#[clap(subcommand)]
pub command: Command,
}
Expand All @@ -38,7 +40,7 @@ pub(crate) mod {{ c.name }} {
use tari_engine_types::instruction::Instruction;
use tari_utilities::hex::Hex;
use tari_utilities::hex::from_hex;

use tari_engine_types::TemplateAddress;
#[derive(Debug, Args, Clone)]
pub struct Command {
{% for arg in c.args %}
Expand All @@ -52,9 +54,9 @@ pub(crate) mod {{ c.name }} {

impl Command {

pub async fn run(self, mut client: DaemonClient) {
pub async fn run(self, mut client: DaemonClient, template_address: TemplateAddress) {

let template_address= from_hex("0c54557e7e3ccfd8b1a632d40d58b4e8f65d319a49495966025350c097847cd8").unwrap().try_into().unwrap();
// let template_address= ;
let function = "{{c.name}}".to_string();


Expand Down
4 changes: 3 additions & 1 deletion applications/tari_scaffolder/src/template/src/main.rs.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use multiaddr::Multiaddr;
use std::str::FromStr;
use reqwest;
use serde_json::json;
use tari_utilities::hex::from_hex;



Expand All @@ -21,10 +22,11 @@ async fn main() {
let jrpc = cli.daemon_jrpc_endpoint.clone().unwrap_or_else(|| "http://127.0.0.1:18016".to_string());
let token = cli.auth_token.clone();
let client= DaemonClient::new(jrpc, token);
let template_address = from_hex(&cli.template).unwrap().try_into().unwrap();
match cli.command {
{% for c in commands %}
Command::{{c.title}}(com) => {
com.run(client).await;
com.run(client, template_address).await;
}
{% endfor %}
}
Expand Down

0 comments on commit 821866f

Please sign in to comment.