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

Fix/static wallets #1063

Merged
merged 3 commits into from
May 21, 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
3 changes: 3 additions & 0 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:

- name: Run tests
run: |
mkdir ./lib/_mock
chmod +w ./lib/_mock
npm run generate-wallets
npm test

- name: Upload report
Expand Down
4 changes: 2 additions & 2 deletions tests/govtool-frontend/playwright/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ node_modules/
tests-out/
.auth/
.download/
lib/_mock/
allure-results/
allure-report/
.secrets
.vars
.lock-pool/
.logs/
.logs/
lib/_mock/wallets.json
44 changes: 44 additions & 0 deletions tests/govtool-frontend/playwright/generate_wallets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { writeFile } from "fs";
import { ShelleyWallet } from "./lib/helpers/crypto";
import extractDRepFromWallet from "./lib/helpers/shellyWallet";

async function generateWallets(num: number): Promise<ShelleyWallet[]> {
const wallets: ShelleyWallet[] = [];

for (let i = 0; i < num; i++) {
wallets.push(await ShelleyWallet.generate());
}
return wallets;
}

function saveWallets(wallets: ShelleyWallet[]): void {
const jsonWallets = [];
for (let i = 0; i < wallets.length; i++) {
const dRepId = extractDRepFromWallet(wallets[i]);

jsonWallets.push({
...wallets[i].json(),
address: wallets[i].addressBech32(0), // testnet
dRepId,
});
}
const jsonString = JSON.stringify(jsonWallets, null, 2);
writeFile("lib/_mock/wallets.json", jsonString, "utf-8", (err) => {
if (err) {
throw new Error("Failed to write wallets into file");
}
});
}

// Get the number of wallets from command line arguments
const numWallets = parseInt(process.argv[2], 10);

if (isNaN(numWallets) || numWallets <= 0) {
console.error("Please provide a valid number of wallets to generate.");
process.exit(1);
}

(async () => {
const wallets = await generateWallets(numWallets);
saveWallets(wallets);
})();
117 changes: 7 additions & 110 deletions tests/govtool-frontend/playwright/lib/constants/staticWallets.ts
Original file line number Diff line number Diff line change
@@ -1,122 +1,19 @@
const staticWallets: StaticWallet[] = require("../_mock/wallets.json");
import { StaticWallet } from "@types";

export const faucetWallet: StaticWallet = {
payment: {
pkh: "b5187cdefbc5b49ddc17b423c079f0717721a03882a3b265bd4c12e0",
private: "11abec096ef0ea7edbeeee01a1a3f0e9f24a7225c2ee99687fb328146fe85ba6",
public: "b6a42d4ccc4d26adaec67e8578bf31f13b1b7e640527356248f2ec547f9de6e4",
},
stake: {
pkh: "80f326af300273d19d5a541d45baa42ebc04265816735b026b5f34a4",
private: "283fd7625ef596f04f21b50ee14a9f4b49f8b1a6f17773cd2e1e69841a111bc1",
public: "86b08ee3d86cb72d026197a5a710e248d66f28fcff21b4467b75f876b4e6d050",
},
dRepId: "drep1zg6zq3ku422ppvfm835rnvzf9ckxtzmy3ayjwylck6s4q9zr5ve",
address:
"addr_test1qz63slx7l0zmf8wuz76z8sre7pchwgdq8zp28vn9h4xp9cyq7vn27vqzw0ge6kj5r4zm4fpwhszzvkqkwddsy66lxjjqxnc9zk",
};
export const faucetWallet = staticWallets[0];

export const dRep01Wallet: StaticWallet = {
payment: {
public: "891ed5096ee248bc7f31a3094ea90f34485483eb1050c7ee368e64d04b90a009",
private: "2f1053f22707b9881ea6112024027a660bd5508e22081cf5e4e95cc663802dd9",
pkh: "5775ad2fb14ca1b45381a40e40f0c06081edaf2261e02bbcebcf8dc3",
},
stake: {
private: "39db531b1ba6d659f0e09ed609e86a080ba2a5629dc5fad3b29890bdba64a014",
public: "45a35ffab6c467531ee528fbdbe1a629de806c7af19dcb5aacb70e4286fd6b9a",
pkh: "46a95c1337b27332131f3c1b9d8e7689edd2f593e7e69bf5dcf0c278",
},
address:
"addr_test1qpthttf0k9x2rdznsxjqus8scpsgrmd0yfs7q2aua08cms6x49wpxdajwvepx8eurwwcua5fahf0tyl8u6dlth8scfuqk8r352",
dRepId: "drep1g654cyehkfenyycl8sdemrnk38ka9avnulnfhawu7rp8skl824l",
};
export const dRep01Wallet = staticWallets[1];
export const dRep02Wallet = staticWallets[2];

export const dRep02Wallet: StaticWallet = {
payment: {
private: "71120ea01dc0c367da113a7ee7b3744a46f793edb4f30a06b46d800324b2c999",
public: "66724455eaacb6dea6686ba09bc159d5deef3d82ebf9c6a60d61748b59e32627",
pkh: "363547ffb44d337f8055515e75e8af516e557b3270bfa4d9198e7195",
},
stake: {
private: "4dfc89a9d680b237146dde69282c709e93ba91ac0b028e980bc40ec573c77f0f",
public: "009c10056aff887d66135886d1fb9f046190bdf1d90a3f9cff954386f7cf37fb",
pkh: "4d52d1d178157ab4c5ab6f8cb109ff91f750b367830463ef8344007e",
},
address:
"addr_test1qqmr23llk3xnxluq24g4ua0g4agku4tmxfctlfxerx88r92d2tgaz7q4026vt2m03jcsnlu37agtxeurq337lq6yqplqftpnqu",
dRepId: "drep1f4fdr5tcz4atf3dtd7xtzz0lj8m4pvm8svzx8murgsq8u6dkmf4",
};

export const adaHolder01Wallet: StaticWallet = {
payment: {
private: "63be29a8c8a73571ab410062f4555998c45a61f96a9bf1c5308c4f3eb7e4453f",
public: "dd1e7ca0deb26499a1336fbe2a5169ba3043a27763bb9e600625a95728be6167",
pkh: "daa1dd48181133eb21a376da773a1d31f72281008d790ecac885ff97",
},
stake: {
private: "13e9e60b51768367c0d4c07a9f02b90d6511a9d7f7215b465fd87488171c687f",
public: "2819c4d6a988746ac7f5be3edc93c86d4cd0e3fae9c23a6ceeb23e6d0b207ad0",
pkh: "56ffa2a26e57c5b14c7c8d58455ebc24ce628f1c456be7e2e7448c8f",
},
address:
"addr_test1qrd2rh2grqgn86ep5dmd5ae6r5clwg5pqzxhjrk2ezzll96kl732ymjhckc5clydtpz4a0pyee3g78z9d0n79e6y3j8smc7gzu",
dRepId: "drep12ml69gnw2lzmznru34vy2h4uyn8x9rcug4470ch8gjxg74htere",
};

export const adaHolder02Wallet: StaticWallet = {
payment: {
private: "6794cee96fd24aa68ae6e7df8548c15c6faf0373fc53c9714517b7c09b2ba6c0",
public: "58df2c02b5a2af09b51d5357f675b4f13ee019db57686adaab7536f6a3b8c29f",
pkh: "aec3d01a7fa061d027e945aedcfcb8e32eab0390063d19ef8ab89a88",
},
stake: {
private: "cb4fa9d68add76c15b2b16b4bb7aeab043d95f42f4adec3d9d50396e6d1760e4",
public: "45dec9c5c130c23b1b9fedda680bdf1658e918087bd0f51c5548c471ca7d2991",
pkh: "49da6cb42b23f1c1f25f85e91dd325414b154f036bbf43a69dea27ee",
},
address:
"addr_test1qzhv85q607sxr5p8a9z6ah8uhr3ja2crjqrr6x0032uf4zzfmfktg2er78qlyhu9aywaxf2pfv257qmthap6d802ylhqvz8qsf",
dRepId: "drep1f8dxedpty0curujlsh53m5e9g9932ncrdwl58f5aagn7u9psjya",
};

// export const soleVoterWallet: StaticWallet = {
// payment: {
// private: "98d35ef14dedc4520ed0153bc41e4db884deb0390f659ee1e28bb52da6045d4e",
// public: "5206735d1a1a1ac4ac625c973581ed97daec145d2e47a5c9bb14754527929f78",
// pkh: "0b5aa57cfd8010b00c649bf281520514de4efd952eba9c31eb7db187",
// },
// stake: {
// private: "95ae1de1c2984c18207b8f57c450f1fbc54c2f0f1b878d3b24df11157277e1d1",
// public: "3bca5cb3599020808f69df269eb42b0e66ecf7455fb969e90c46ae0ac55e6572",
// pkh: "97265a1e13717c04a85e7d6dc156ba38340645b1e812a935823092f9",
// },
// address:
// "addr_test1qq944ftulkqppvqvvjdl9q2jq52dunhaj5ht48p3ad7mrpuhyedpuym30sz2shnadhq4dw3cxsrytv0gz25ntq3sjtusesfzgd",
// dRepId: "drep1jun958snw97qf2z704kuz4468q6qv3d3aqf2jdvzxzf0jtlmwlf",
// };
export const adaHolder01Wallet = staticWallets[3];
export const adaHolder02Wallet = staticWallets[4];

// Does not takes part in transaction
export const user01Wallet: StaticWallet = {
payment: {
private: "a84d81412e41b55f9a484ce2cb5849660c7a8874df7ea11cb48120ec8efd2911",
public: "18cc2696ff588c19789f908df838fc58dd58986ebf6191b7b63d310c997f968b",
pkh: "56a6427fa7f8599d1e49271eb8123d0e02bc06bd44fc2d988e25455a",
},
stake: {
private: "c3d9fde8d81c1533ab9a1e6fdbaddd792dfba8f58656c95e83f5e967087f4605",
public: "dd50a02daa77061ecd2d43d6fa1049e3db0192b94112ffc4f4e48975362987ff",
pkh: "cac600470e3b3027bf3ad3c363c35c690a54308bd001120194c1ba0b",
},
address:
"addr_test1qpt2vsnl5lu9n8g7fyn3awqj858q90qxh4z0ctvc3cj52kk2ccqywr3mxqnm7wkncd3uxhrfpf2rpz7sqyfqr9xphg9s77zxlg",
dRepId: "drep1etrqq3cw8vcz00e660pk8s6udy99gvyt6qq3yqv5cxaqkuupyzg",
};
export const user01Wallet: StaticWallet = staticWallets[5];

export const adaHolderWallets = [adaHolder01Wallet, adaHolder02Wallet];

export const userWallets = [user01Wallet];

export const dRepWallets = [dRep01Wallet];

// export const soleVoterWallets = [soleVoterWallet];
Loading