From 50ad4066f63391e58ba1924f75148d6db0d45dc2 Mon Sep 17 00:00:00 2001 From: Artemka374 Date: Mon, 14 Aug 2023 10:50:37 +0300 Subject: [PATCH] add execute method --- tests/e2e/governance/helper.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/e2e/governance/helper.ts b/tests/e2e/governance/helper.ts index 6afbce075..3ff088b1e 100644 --- a/tests/e2e/governance/helper.ts +++ b/tests/e2e/governance/helper.ts @@ -3,6 +3,8 @@ import {Transaction, VoteType} from '../../../typechain-generated/types-argument import ContractGovernance from '../../../typechain-generated/contracts/my_governor' import {KeyringPair} from '@polkadot/keyring/types' import {expect} from 'chai' +import {blake2b} from "@polkadot/wasm-crypto"; +import {blake2AsU8a} from "@polkadot/util-crypto"; export class GovernorHelper { private proposal: Transaction | undefined; @@ -55,4 +57,14 @@ export class GovernorHelper { const proposalDeadline = (await this.governor?.query.proposalDeadline(this.proposalId as unknown as number[]))?.value.unwrapRecursively().ok await this.governor?.tx.setBlockTimestamp(proposalDeadline as number) } + + async execute(proposer: KeyringPair) { + if (this.proposalId === undefined) { + throw new Error('Proposal Id not set') + } + + const descriptionHash = blake2AsU8a(this.description!) as unknown as number[] + + await this.governor?.withSigner(proposer).tx.execute([this.proposal!], descriptionHash) + } } \ No newline at end of file