Skip to content

Commit 9967f98

Browse files
authored
Merge pull request #3574 from IntersectMBO/feat/fauct-env-config
Add Faucet Wallet Generation Script and Update README with Setup Instructions
2 parents 2e4bee7 + 04918ab commit 9967f98

File tree

3 files changed

+103
-5
lines changed

3 files changed

+103
-5
lines changed

tests/govtool-frontend/playwright/README.md

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,76 @@ npx playwright install
7979

8080
---
8181

82+
## 🔧 Faucet wallet Configuration
83+
84+
This section guides you through generating a Cardano faucet wallet and configuring it for use. Follow the steps below to create and set the config on env
85+
86+
### Step 1: Generate a Faucet Wallet
87+
88+
Run the following command to generate a new faucet wallet:
89+
90+
```bash
91+
npm run generate-faucet-wallet
92+
```
93+
94+
The script will:
95+
96+
- Display the wallet details (payment private key, stake public key hash, and wallet address) in the terminal.
97+
98+
**Example Output:**
99+
100+
```
101+
🎉 Wallet generated successfully!
102+
-----------------------------------
103+
🔑 Payment Private Key: <your-payment-private-key>
104+
🔗 Stake Public Key Hash: <your-stake-pkh>
105+
🏠 Wallet Address: <your-wallet-address>
106+
-----------------------------------
107+
108+
📋 Please copy the following to your environment variables:
109+
1. Set FAUCET_PAYMENT_PRIVATE=<your-payment-private-key>
110+
2. Set FAUCET_STAKE_PKH=<your-stake-pkh>
111+
3. Set FAUCET_ADDRESS=<your-wallet-address>
112+
113+
🎈 All set! Please ensure this wallet is funded with a sufficient balance
114+
```
115+
116+
### Step 2: Configure Environment Variables
117+
118+
Securely store the generated wallet details in your environment variables. Add the following to your `.env` file or environment configuration:
119+
120+
```env
121+
FAUCET_PAYMENT_PRIVATE=<your-payment-private-key>
122+
FAUCET_STAKE_PKH=<your-stake-pkh>
123+
FAUCET_ADDRESS=<your-wallet-address>
124+
```
125+
126+
⚠️ **Security Note**: Store your wallet details in a secure location for future use. The payment private key is sensitive and must be protected to prevent unauthorized access to your funds.
127+
128+
### Step 3: Fund the Wallet
129+
130+
Ensure the wallet address has sufficient funds for your test runs. The required balance depends on the specific tests you plan to execute (refer to the test-specific test run details below).
131+
132+
To check the wallet balance, visit:
133+
134+
```
135+
https://${network}.cardanoscan.io/address/<your-wallet-address>
136+
```
137+
138+
Replace `${network}` with the appropriate Cardano network (e.g.`preprod`, or `preview`) and `<your-wallet-address>` with the generated address.
139+
140+
**Example**:
141+
142+
- For a preview wallet: `https://preview.cardanoscan.io/address/<your-wallet-address>`
143+
- Monitor the balance to ensure it meets the requirements for individual or all test runs.
144+
145+
---
146+
82147
## 🧪 Running Tests
83148

84149
### 🔑 Generate Test Wallets
85150

86-
Before each test run, generate fresh test wallets to avoid conflicts:
151+
Before each test run, generate test wallets required for wallet-dependent tests:
87152

88153
```bash
89154
npm run generate-wallets
@@ -115,7 +180,7 @@ Each test suite can be run in **UI** or **Headless** mode.
115180

116181
---
117182

118-
#### 1. **Delegation Pillars**
183+
#### 1. **Delegation Pillar**
119184

120185
- **Pre-requisite**: Ensure the faucet address holds at least **12,000 ADA**.
121186

@@ -133,7 +198,7 @@ npm run test:headless:delegation-pillar
133198

134199
---
135200

136-
#### 2. **Voting Pillars**
201+
#### 2. **Voting Pillar**
137202

138203
- **Pre-requisite**: Ensure the faucet address holds at least **12,000 ADA**.
139204

@@ -167,7 +232,7 @@ npm run test:headless:outcomes
167232

168233
---
169234

170-
#### 4. **Proposal Pillars**
235+
#### 4. **Proposal Pillar**
171236

172237
_Includes both Proposal Discussion and Budget Discussion_
173238

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { ShelleyWallet } from "./lib/helpers/crypto";
2+
3+
(async () => {
4+
try {
5+
console.log("\nGenerating your wallet... 🔐");
6+
const wallet = await ShelleyWallet.generate();
7+
const walletJson = wallet.json();
8+
9+
// Display wallet details
10+
console.log("\n🎉 Wallet generated successfully!");
11+
console.log("-----------------------------------");
12+
console.log("💼 Wallet:", walletJson);
13+
console.log(`🔑 Payment Private Key: ${walletJson.payment.private}`);
14+
console.log(`🔗 Stake Public Key Hash: ${walletJson.stake.pkh}`);
15+
console.log(`🏠 Wallet Address: ${walletJson.address}`);
16+
console.log("-----------------------------------");
17+
18+
// Instructions for environment variables
19+
console.log(
20+
"\n📋 Please copy the following to your environment variables:"
21+
);
22+
console.log(`1. Set FAUCET_PAYMENT_PRIVATE=${walletJson.payment.private}`);
23+
console.log(`2. Set FAUCET_STAKE_PKH=${walletJson.stake.pkh}`);
24+
console.log(`3. Set FAUCET_ADDRESS=${walletJson.address}`);
25+
26+
console.log(
27+
"\n🎈 All set! Please ensure this wallet is funded with a sufficient balance"
28+
);
29+
} catch (error) {
30+
console.error("\n❌ An error occurred:", error.message);
31+
}
32+
})();

tests/govtool-frontend/playwright/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"test:headless:usersnap": "npx playwright test userSnap.spec.ts",
4545
"test:headless:misc": "npx playwright test miscellaneous",
4646
"format": "prettier . --write",
47-
"generate-wallets": "ts-node ./generate_wallets.ts 23"
47+
"generate-wallets": "ts-node ./generate_wallets.ts 23",
48+
"generate-faucet-wallet": "ts-node ./generate_faucet_wallet.ts"
4849
},
4950
"dependencies": {
5051
"@cardanoapi/cardano-test-wallet": "^3.3.1",

0 commit comments

Comments
 (0)