Skip to content

Commit

Permalink
add page for humanoid
Browse files Browse the repository at this point in the history
  • Loading branch information
vol4tim committed Jan 7, 2025
1 parent 376b798 commit 7ec49d1
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/router.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { createRouter, createWebHashHistory } from "vue-router";
import Altruist from "./views/hardware/Altruist.vue";
import Hikikomori from "./views/hardware/Hikikomori.vue";
import Riscv from "./views/hardware/Riscv.vue";
import SeasonPass2 from "./views/hardware/Season-pass-2.vue";
import SeasonPass from "./views/hardware/Season-pass.vue";
import Smartsafe from "./views/hardware/Smart-safe.vue";
import Home from "./views/Home.vue";
import Humanoid from "./views/humanoid/RobonomicsApp.vue";
import PathNotFound from "./views/PathNotFound.vue";
import RwsActivate from "./views/RwsActivate.vue";
import RwsSetup from "./views/RwsSetup.vue";
import RwsSetupNew from "./views/RwsSetupNew.vue";
import Services from "./views/Services.vue";
import Telemetry from "./views/telemetry/Telemetry.vue";
import Altruist from "./views/hardware/Altruist.vue";
import Riscv from "./views/hardware/Riscv.vue";
import Hikikomori from "./views/hardware/Hikikomori.vue";
import Smartsafe from "./views/hardware/Smart-safe.vue";
import SeasonPass from "./views/hardware/Season-pass.vue";
import SeasonPass2 from "./views/hardware/Season-pass-2.vue";

const routes = [
{
Expand Down Expand Up @@ -110,6 +111,14 @@ const routes = [
title: "Season Pass 2"
}
},
{
path: "/humanoid",
name: "Humanoid",
component: Humanoid,
meta: {
title: "The-Rise-of-Humanoids"
}
},
{ path: "/:pathMatch(.*)*", component: PathNotFound }
];

Expand Down
19 changes: 19 additions & 0 deletions src/views/humanoid/RobonomicsApp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<robo-layout-section>
<robo-section offset="x2" width="narrow">
<h3>The-Rise-of-Humanoids</h3>
</robo-section>

<template v-if="RobonomicsProvider.isReady">
<robonomics-launch />
</template>
<template v-else>...</template>
</robo-layout-section>
</template>

<script setup>
import { inject } from "vue";
import RobonomicsLaunch from "./RobonomicsLaunch.vue";
const RobonomicsProvider = inject("RobonomicsProvider");
</script>
72 changes: 72 additions & 0 deletions src/views/humanoid/RobonomicsLaunch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<template>
<robo-section offset="x2" width="narrow">
<robo-section offset="x3">
<robo-select
block
:values="commands.map((item) => item.value)"
:options="commands.map((item) => item.name)"
v-model="parameter"
/>
<robo-button @click="send" block :loading="proccess">Send</robo-button>
<robo-text weight="bold" v-if="result">{{ result }}</robo-text>
<robo-text highlight="error" v-if="error">{{ error }}</robo-text>
</robo-section>
</robo-section>
</template>

<script>
import { ref, inject } from "vue";
import * as config from "./config";
export default {
setup() {
const RobonomicsProvider = inject("RobonomicsProvider");
const proccess = ref(false);
const result = ref(null);
const error = ref(null);
const commands = ref(config.listOfCommands);
const parameter = ref(config.listOfCommands[0].value);
const unsubscribe = ref(null);
const send = async () => {
error.value = "";
result.value = "";
proccess.value = true;
try {
const txs = [
RobonomicsProvider.instance.value.api.tx.balances.transfer(
config.robot,
config.price
),
RobonomicsProvider.instance.value.launch.send(
config.robot,
parameter.value
)
];
const tx = RobonomicsProvider.instance.value.api.tx.utility.batch(txs);
const resultTx =
await RobonomicsProvider.instance.value.accountManager.signAndSend(
tx
);
console.log("saved", resultTx);
result.value = `${resultTx.blockNumber}-${resultTx.txIndex}`;
} catch (error) {
console.log(error);
error.value = error.message;
}
proccess.value = false;
};
return {
proccess,
result,
error,
commands,
parameter,
unsubscribe,
send
};
}
};
</script>
16 changes: 16 additions & 0 deletions src/views/humanoid/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const price = 1_000_000_000;
export const robot = "4GzMLepDF5nKTWDM6XpB3CrBcFmwgazcVFAD3ZBNAjKT6hQJ";
export const listOfCommands = [
{
name: "A",
value: "0x0000000000000000000000000000000000000000000000000000000000000001"
},
{
name: "B",
value: "0x0000000000000000000000000000000000000000000000000000000000000002"
},
{
name: "C",
value: "0x0000000000000000000000000000000000000000000000000000000000000003"
}
];

0 comments on commit 7ec49d1

Please sign in to comment.