Skip to content

Commit 5e81b66

Browse files
committed
chore: update script
1 parent 5c65206 commit 5e81b66

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dist-ssr
2828

2929
app/scripts/.store
3030
app/deployed-contract.json
31+
app/wallet-info.json
3132

3233

3334
# Playwright

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ You can now interact with the deployed contract using the web app:
5959
- Open another browser (or an incognito window), create a new account, and cast a vote
6060
- See the updated vote results in the first browser
6161

62+
You can also run the E2E tests:
63+
64+
```sh
65+
(cd app && yarn test)
66+
```
67+
6268
<br />
6369

6470
## Disable client proofs

app/scripts/deploy.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function setupPXE() {
1818

1919
const pxeDataDirectory = path.join(import.meta.dirname, '.store');
2020
fs.rmSync(pxeDataDirectory, { recursive: true, force: true });
21-
21+
2222
const store = await createStore('pxe', {
2323
dataDirectory: pxeDataDirectory,
2424
dataStoreMapSizeKB: 1e6,
@@ -70,12 +70,7 @@ async function createAccount(pxe: PXE) {
7070

7171
return {
7272
wallet,
73-
credentials: {
74-
salt: salt.toString(),
75-
secretKey: secretKey.toString(),
76-
signingKey: Buffer.from(signingKey).toString('hex'),
77-
address: wallet.getAddress().toString()
78-
}
73+
signingKey,
7974
};
8075
}
8176

@@ -123,20 +118,24 @@ async function createAccountAndDeployContract() {
123118
await pxe.registerContract({ instance: await getSponsoredPFCContract(), artifact: SponsoredFPCContractArtifact });
124119

125120
// Create a new account
126-
const { wallet, credentials } = await createAccount(pxe);
121+
const { wallet, signingKey } = await createAccount(pxe);
122+
123+
// Save the wallet info
124+
const walletInfo = {
125+
address: wallet.getAddress().toString(),
126+
salt: wallet.salt.toString(),
127+
secretKey: wallet.getSecretKey().toString(),
128+
signingKey: Buffer.from(signingKey).toString('hex'),
129+
}
130+
fs.writeFileSync(path.join(import.meta.dirname, '../wallet-info.json'), JSON.stringify(walletInfo, null, 2));
131+
console.log('\n\n\nWallet info saved to wallet-info.json\n\n\n');
127132

128133
// Deploy the contract
129134
const deploymentInfo = await deployContract(pxe, wallet);
130135

131-
// Combine all information
132-
const fullInfo = {
133-
walletInfo: credentials,
134-
deploymentInfo
135-
};
136-
136+
// Save the deployment info
137137
const outputPath = path.join(import.meta.dirname, '../deployed-contract.json');
138-
fs.writeFileSync(outputPath, JSON.stringify(fullInfo, null, 2));
139-
138+
fs.writeFileSync(outputPath, JSON.stringify(deploymentInfo, null, 2));
140139
console.log('\n\n\nContract deployed successfully. All info saved to deployed-contract.json\n\n\nIMPORTANT: Do not lose this file as you will not be able to recover the contract address if you lose it.\n\n\n');
141140
}
142141

contracts/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
rm -rf ../app/artifacts
22
rm -rf ./target
3+
rm -rf ./codegenCache.json
34

45
# Compile the contracts
56
aztec-nargo compile

0 commit comments

Comments
 (0)