yarn install
yarn run serve
yarn run build
yarn run test
yarn run lint
In order to execute some transaction you can use exec
located in src/utils/transactionExecutor.ts
Usage:
import exec from '@/utils/transactionExecutor';
// arguments: from which account, password for account, which action, array of parameters
this.tx = await exec(this.account, this.password, api.tx.democracy.vote, [referendumId, { aye, conviction }]);
Some of the properies on the component needs to be automatically updated (currentBlock)
Usage:
<template>
<div>{{ currentBlock }}</div>
</template>
<script lang="ts">
// Skipping imports
export default class Summary extends Vue {
private currentBlock: any = {};
private subs: any[] = [];
public async mounted() {
this.subs.push(await api.derive.chain.bestNumber(value => this.currentBlock = value));
}
// Unsubscribe before destroying component
public beforeDestroy() {
this.subs.forEach((sub) => sub());
}
}
</script>