Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

Commit

Permalink
Refactor create_validator function
Browse files Browse the repository at this point in the history
  • Loading branch information
necipsagiro committed Feb 29, 2024
1 parent cb4f055 commit 535cc9e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
27 changes: 14 additions & 13 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,26 +859,27 @@ fn create_validator(
.map_err(|e| e.to_string())?;
let command = match exception.as_str() {
"babylon" => format!(
"echo '{{
\"pubkey\": '$(babylond tendermint show-validator)',
\"amount\": \"{amount}\'\"${{DENOM}}\"\'\",
\"moniker\": \"{moniker_name}\",
\"identity\": \"{keybase_id}\",
\"website\": \"{website}\",
\"details\": \"{details}\",
\"commission-rate\": \"{com_rate}\",
\"commission-max-rate\": \"0.20\",
\"commission-max-change-rate\": \"0.01\",
\"min-self-delegation\": \"1\"
}}' > $HOME/$SYSTEM_FOLDER/data/validator.json;
r#"bash -c -l 'touch $HOME/$SYSTEM_FOLDER/data/validator.json' &&
bash -c -l 'echo {{ \
\"pubkey\": $(babylond tendermint show-validator), \
\"amount\": \"{amount}$DENOM\", \
\"moniker\": \"{moniker_name}\", \
\"identity\": \"{keybase_id}\", \
\"website\": \"{website}\", \
\"details\": \"{details}\", \
\"commission-rate\": \"{com_rate}\", \
\"commission-max-rate\": \"0.20\", \
\"commission-max-change-rate\": \"0.01\", \
\"min-self-delegation\": \"1\" \
}} > $HOME/$SYSTEM_FOLDER/data/validator.json' &&
yes '{password}' | bash -c -l '$EXECUTE tx checkpointing create-validator $HOME/$SYSTEM_FOLDER/data/validator.json -y \
--output json \
--keyring-backend test \
--chain-id=$CHAIN_ID \
--gas=auto \
--gas-adjustment=1.4 \
--gas-prices={fees}$DENOM \
--from={wallet_name}' 2>&1",
--from={wallet_name}' 2>&1"#,
password = my_boxed_session.walletpassword,
),
_ => format!(
Expand Down
2 changes: 1 addition & 1 deletion src/node-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ const addValidatorSetup = () => {
details: document.querySelectorAll(".each-input-field")[8].value,
exception: exception
}).then(async (res) => {
res = res.slice(res.indexOf('{'));
console.log(res);
res = res.slice(res.indexOf('{'));
res = JSON.parse(res);
if (res.raw_log.length == 2) {
createMessage("Tx Hash", res.txhash);
Expand Down
2 changes: 1 addition & 1 deletion src/page-content/add-validator.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>
<div class="each-input">
<div class="each-input-label">Commission Rate</div>
<input class="each-input-field" placeholder="0.05"></input>
<input class="each-input-field" placeholder=" " value="0.05"></input>
<div class="each-input-field-border"></div>
</div>
</div>
Expand Down

0 comments on commit 535cc9e

Please sign in to comment.