Browse Source

estimate and create begin review proposal calls implemented

Gleb Urvanov 4 years ago
parent
commit
3a736e0262

+ 5 - 3
tests/network-tests/src/nicaea/tests/proposals/impl/proposalsModule.ts

@@ -1,5 +1,5 @@
 import { KeyringPair } from '@polkadot/keyring/types';
-import { ApiWrapper } from '../../../utils/apiWrapper';
+import { ApiWrapper, WorkingGroups } from '../../../utils/apiWrapper';
 import { v4 as uuid } from 'uuid';
 import BN from 'bn.js';
 import { assert } from 'chai';
@@ -54,7 +54,9 @@ export async function createWorkingGroupLeaderOpening(
 export async function beginWorkingGroupLeaderApplicationReview(
   apiWrapper: ApiWrapper,
   m1KeyPairs: KeyringPair[],
-  sudo: KeyringPair
+  sudo: KeyringPair,
+  openingId: BN,
+  workingGroup: string
 ) {
   // Setup
   const proposalTitle: string = 'Testing proposal ' + uuid().substring(0, 8);
@@ -73,7 +75,7 @@ export async function beginWorkingGroupLeaderApplicationReview(
     description,
     proposalStake,
     openingId,
-    WorkingGroups.storage
+    workingGroup
   );
   const proposalNumber: BN = await proposalPromise;
   return proposalNumber;

+ 36 - 0
tests/network-tests/src/nicaea/utils/apiWrapper.ts

@@ -310,6 +310,19 @@ export class ApiWrapper {
     );
   }
 
+  public estimateProposeBeginWorkingGroupLeaderApplicationReview(): BN {
+    return this.estimateTxFee(
+      this.api.tx.proposalsCodex.createBeginReviewWorkingGroupLeaderApplicationsProposal(
+        0,
+        'Some testing text used for estimation purposes which is longer than text expected during the test',
+        'Some testing text used for estimation purposes which is longer than text expected during the test',
+        0,
+        0,
+        'Storage'
+      )
+    );
+  }
+
   private applyForCouncilElection(account: KeyringPair, amount: BN): Promise<void> {
     return this.sender.signAndSend(this.api.tx.councilElection.apply(amount), account, false);
   }
@@ -601,6 +614,29 @@ export class ApiWrapper {
     );
   }
 
+  public async proposeBeginWorkingGroupLeaderApplicationReview(
+    account: KeyringPair,
+    title: string,
+    description: string,
+    stake: BN,
+    openingId: BN,
+    workingGroup: string
+  ) {
+    const memberId: BN = (await this.getMemberIds(account.address))[0].toBn();
+    return this.sender.signAndSend(
+      this.api.tx.proposalsCodex.createBeginReviewWorkingGroupLeaderApplicationsProposal(
+        memberId,
+        title,
+        description,
+        stake,
+        openingId,
+        workingGroup
+      ),
+      account,
+      false
+    );
+  }
+
   public approveProposal(account: KeyringPair, memberId: BN, proposal: BN): Promise<void> {
     return this.sender.signAndSend(this.api.tx.proposalsEngine.vote(memberId, proposal, 'Approve'), account, false);
   }