Skip to content

Commit 093cfd7

Browse files
authored
Merge pull request #64 from AztecProtocol/jc/deploy-account-79
create deploy account script
2 parents c857d80 + 018630c commit 093cfd7

File tree

4 files changed

+38
-7
lines changed

4 files changed

+38
-7
lines changed

.github/workflows/tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ jobs:
4545

4646
- name: Run tests
4747
run: script -e -c "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json && aztec test"
48+
49+
- name: Run scripts
50+
run: script -e -c "yarn deploy && yarn deploy-account"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"clean": "rm -rf ./src/artifacts ./target",
1212
"codegen": "aztec codegen target --outdir src/artifacts",
1313
"compile": "${AZTEC_NARGO:-aztec-nargo} compile",
14-
"deploy": "node --loader ts-node/esm scripts/deploy.ts",
14+
"deploy": "node --loader ts-node/esm scripts/deploy-contract.ts",
15+
"deploy-account": "node --loader ts-node/esm scripts/deploy-account.ts",
1516
"get-block": "node --loader ts-node/esm scripts/getBlock.ts",
1617
"test": "yarn test:js && yarn test:nr",
1718
"test:js": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json",
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { EasyPrivateVotingContract } from "../src/artifacts/EasyPrivateVoting.js"
21
import { AccountWallet, CompleteAddress, createLogger, Fr, PXE, waitForPXE, createPXEClient, Logger } from "@aztec/aztec.js";
32
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
43
import { deriveSigningKey } from '@aztec/stdlib/keys';
54
import { getInitialTestAccountsWallets } from "@aztec/accounts/testing";
6-
import { TokenContract } from "@aztec/noir-contracts.js/Token"
5+
import { SponsoredFeePaymentMethod } from "../src/test/sponsored_fee_payment_method.js";
6+
77

88
const setupSandbox = async () => {
99
const { PXE_URL = 'http://localhost:8080' } = process.env;
@@ -23,17 +23,16 @@ async function main() {
2323

2424
pxe = await setupSandbox();
2525
wallets = await getInitialTestAccountsWallets(pxe);
26+
const sponsoredPaymentMethod = await SponsoredFeePaymentMethod.new(pxe);
2627

2728
let secretKey = Fr.random();
2829
let salt = Fr.random();
2930

3031
let schnorrAccount = await getSchnorrAccount(pxe, secretKey, deriveSigningKey(secretKey), salt);
31-
const { address, publicKeys, partialAddress } = await schnorrAccount.getCompleteAddress()
32-
let tx = await schnorrAccount.deploy().wait();
32+
let tx = await schnorrAccount.deploy({ fee: { paymentMethod: sponsoredPaymentMethod } }).wait();
3333
let wallet = await schnorrAccount.getWallet();
3434

35-
const votingContract = await EasyPrivateVotingContract.deploy(wallet, address).send().deployed();
36-
logger.info(`Voting Contract deployed at: ${votingContract.address}`);
35+
logger.info(`Schnorr account deployed at: ${wallet.getAddress()}`);
3736
}
3837

3938
main();

scripts/deploy-contract.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { EasyPrivateVotingContract } from "../src/artifacts/EasyPrivateVoting.js"
2+
import { AccountWallet, createLogger, PXE, waitForPXE, createPXEClient, Logger } from "@aztec/aztec.js";
3+
import { getInitialTestAccountsWallets } from "@aztec/accounts/testing";
4+
import { TokenContract } from "@aztec/noir-contracts.js/Token"
5+
6+
const setupSandbox = async () => {
7+
const { PXE_URL = 'http://localhost:8080' } = process.env;
8+
const pxe = await createPXEClient(PXE_URL);
9+
await waitForPXE(pxe);
10+
return pxe;
11+
};
12+
13+
async function main() {
14+
15+
let pxe: PXE;
16+
let wallets: AccountWallet[] = [];
17+
let logger: Logger;
18+
19+
logger = createLogger('aztec:aztec-starter');
20+
21+
pxe = await setupSandbox();
22+
wallets = await getInitialTestAccountsWallets(pxe);
23+
24+
const votingContract = await EasyPrivateVotingContract.deploy(wallets[0], wallets[0].getAddress()).send().deployed();
25+
logger.info(`Voting Contract deployed at: ${votingContract.address}`);
26+
}
27+
28+
main();

0 commit comments

Comments
 (0)