Skip to content

Commit

Permalink
Merge pull request #2813 from threefoldtech/dev_remove_algorand_parti…
Browse files Browse the repository at this point in the history
…cipant

Dev remove algorand participant
  • Loading branch information
amiraabouhadid authored Jun 2, 2024
2 parents da838d9 + 73b9516 commit 17d861b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 106 deletions.
8 changes: 1 addition & 7 deletions packages/grid_client/scripts/applications/algorand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,8 @@ async function main() {
SSH_KEY: config.ssh_key,
// Select a network to work against.
NETWORK: "mainnet",
// Defualt, Relay, Participant, Indexer
// Default, Relay, Indexer
NODE_TYPE: "default",
// Account mnemonic is the private key of your Algorand wallet and it consists of 24 words, and these 3 options are only enabled on Participant.
//ACCOUNT_MNEMONICS: "",
// First Validation Block.
//FIRST_ROUND: "24000000",
// Last Validation Block
//LAST_ROUND: "26000000",
},
},
],
Expand Down
101 changes: 2 additions & 99 deletions packages/playground/src/weblets/tf_algorand.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,86 +56,12 @@
label="Node Type"
:items="[
{ title: 'Default', value: 'default' },
{ title: 'Participant', value: 'participant' },
{ title: 'Relay', value: 'relay' },
{ title: 'Indexer', value: 'indexer' },
]"
v-model="type"
/>
</input-tooltip>

<template v-if="type === 'participant'">
<input-validator
:value="account"
:rules="[
validators.required('Mnemonic is required.'),
value => {
return validators.isAlpha('Mnemonic can contain only alphabetic characters.')(value.replace(/\s/g, ''));
},
customAccountValidation,
]"
#="{ props }"
>
<input-tooltip
tooltip="Account mnemonic is the private key of your Algorand wallet and it consists of 24 words "
>
<v-text-field
label="Account Mnemonic"
placeholder="Algorand Account Mnemonic"
v-model.trim="account"
v-bind="props"
autofocus
counter
>
<template #counter>
<span :class="{ 'text-red': wordsLength > 25 }">{{ wordsLength }}</span>
/ 25
</template>
</v-text-field>
</input-tooltip>
</input-validator>

<input-validator
:value="firstRound"
:rules="[
validators.required('First round is required.'),
validators.isInt('First round must be a valid integer.'),
validators.min('First round must be greater than 0.', 1),
]"
#="{ props }"
>
<input-tooltip tooltip="First Validation Block.">
<v-text-field
label="First Round"
placeholder="First Validation Block"
v-model.number="firstRound"
v-bind="props"
type="number"
/>
</input-tooltip>
</input-validator>

<input-validator
:value="lastRound"
:rules="[
validators.required('Last round is required.'),
validators.isInt('Last round must be a valid integer.'),
customLastRoundValidation(validators),
]"
#="{ props }"
ref="lastRoundInput"
>
<input-tooltip tooltip="Last Validation Block">
<v-text-field
label="Last Round"
placeholder="Last Validation Block"
v-model.number="lastRound"
v-bind="props"
type="number"
/>
</input-tooltip>
</input-validator>
</template>
</AlgorandCapacity>

<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
Expand Down Expand Up @@ -184,15 +110,14 @@ import { computed, type Ref, ref, watch } from "vue";
import { manual } from "@/utils/manual";
import { useLayout } from "../components/weblet_layout.vue";
import { useGrid, useProfileManager } from "../stores";
import { type Flist, ProjectName, type Validators } from "../types";
import { useGrid } from "../stores";
import { type Flist, ProjectName } from "../types";
import { deployVM } from "../utils/deploy_vm";
import { generateName } from "../utils/strings";
const layout = useLayout();
const valid = ref(false);
const lastRoundInput = ref();
const profileManager = useProfileManager();
const flist: Flist = {
value: "https://hub.grid.tf/tf-official-apps/algorand-latest.flist",
entryPoint: "/sbin/zinit init",
Expand All @@ -205,8 +130,6 @@ const memory = ref() as Ref<number>;
const storage = ref() as Ref<number>;
const network = ref("mainnet");
const type = ref("default");
const account = ref("");
const wordsLength = computed(() => (account.value ? account.value.split(" ").length : 0));
const firstRound = ref(24000000);
const lastRound = ref(26000000);
const dedicated = ref(false);
Expand Down Expand Up @@ -260,13 +183,6 @@ async function deploy() {
{ key: "SSH_KEY", value: selectedSSHKeys.value },
{ key: "NETWORK", value: network.value },
{ key: "NODE_TYPE", value: type.value },
...(type.value === "participant"
? [
{ key: "ACCOUNT_MNEMONICS", value: account.value },
{ key: "FIRST_ROUND", value: firstRound.value.toString() },
{ key: "LAST_ROUND", value: lastRound.value.toString() },
]
: []),
],
},
],
Expand All @@ -280,19 +196,6 @@ async function deploy() {
}
}
function customAccountValidation(value: string) {
if (value.split(" ").length !== 25) {
return { message: "Mnemonic must have 25 words separated by spaces." };
}
}
function customLastRoundValidation(validators: Validators) {
return (value: string) => {
const min = firstRound.value;
return validators.min(`Last round must be greater than ${min}`, min + 1)(value);
};
}
function updateSSHkeyEnv(selectedKeys: string) {
selectedSSHKeys.value = selectedKeys;
}
Expand Down

0 comments on commit 17d861b

Please sign in to comment.