Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace hardcoded dRep registration amount with protocol params #1184

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions tests/govtool-frontend/playwright/lib/services/kuberService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { faucetWallet } from "@constants/staticWallets";
import { KuberValue, StaticWallet } from "@types";
import { KuberValue, ProtocolParams, StaticWallet } from "@types";
import * as blake from "blakejs";
import environments from "lib/constants/environments";
import { LockInterceptor, LockInterceptorInfo } from "lib/lockInterceptor";
Expand Down Expand Up @@ -168,7 +168,9 @@ const kuberService = {
return kuber.signAndSubmitTx(req);
},

multipleTransferADA: (outputs: { address: string; value: string }[]) => {
multipleTransferADA: (
outputs: { address: string; value: string | number }[]
) => {
const kuber = new Kuber(faucetWallet.address, faucetWallet.payment.private);
const req = {
outputs,
Expand Down Expand Up @@ -326,6 +328,10 @@ const kuberService = {
>;
},

queryProtocolParams() {
return callKuber("/api/v3/protocol-params") as Promise<ProtocolParams>;
},

voteOnProposal(
addr: string,
signingKey: string,
Expand Down
5 changes: 5 additions & 0 deletions tests/govtool-frontend/playwright/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,8 @@ export type IDRep = {
latestTxHash: string;
latestRegistrationDate: string;
};

export type ProtocolParams = {
dRepDeposit: number;
govActionDeposit: number;
};
9 changes: 8 additions & 1 deletion tests/govtool-frontend/playwright/tests/dRep.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import walletManager from "lib/walletManager";
const REGISTER_DREP_WALLETS_COUNT = 9;
const DREP_WALLETS_COUNT = 9;

let dRepDeposit: number;

setup.beforeAll(async () => {
const res = await kuberService.queryProtocolParams();
dRepDeposit = res.dRepDeposit;
});

setup.beforeEach(async () => {
await setAllureEpic("Setup");
await setAllureStory("Register DRep");
Expand Down Expand Up @@ -64,7 +71,7 @@ setup("Setup temporary DRep wallets", async () => {

// transfer 600 ADA for dRep registration
const amountOutputs = registerDRepWallets.map((wallet) => {
return { address: wallet.address, value: `${600}A` };
return { address: wallet.address, value: dRepDeposit };
});
const transferRes = await kuberService.multipleTransferADA(amountOutputs);
await pollTransaction(transferRes.txId, transferRes.lockInfo);
Expand Down
2 changes: 1 addition & 1 deletion tests/govtool-frontend/playwright/tests/faucet.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ setup.beforeEach(async () => {

setup("Faucet setup", async () => {
const balance = await kuberService.getBalance(faucetWallet.address);
if (balance > 1_00_000) return;
if (balance > 100_000) return;

const res = await loadAmountFromFaucet(faucetWallet.address);
await pollTransaction(res.txid);
Expand Down