Skip to content

Commit cabaa7c

Browse files
committed
test: move token deploy functions to utils
1 parent 0ac1738 commit cabaa7c

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

src/ts/test/token.test.ts

+1-25
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,7 @@ import {
1212
IntentAction,
1313
} from '@aztec/aztec.js';
1414
import { getInitialTestAccountsWallets } from '@aztec/accounts/testing';
15-
import { AMOUNT, createPXE, expectTokenBalances, expectUintNote, setupSandbox, wad } from './utils.js';
16-
17-
export async function deployTokenWithInitialSupply(deployer: AccountWallet) {
18-
const contract = await Contract.deploy(
19-
deployer,
20-
TokenContractArtifact,
21-
['PrivateToken', 'PT', 18, 0, deployer.getAddress()],
22-
'constructor_with_initial_supply',
23-
)
24-
.send()
25-
.deployed();
26-
return contract;
27-
}
28-
29-
export async function deployTokenWithMinter(deployer: AccountWallet) {
30-
const contract = await Contract.deploy(
31-
deployer,
32-
TokenContractArtifact,
33-
['PrivateToken', 'PT', 18, deployer.getAddress()],
34-
'constructor_with_minter',
35-
)
36-
.send()
37-
.deployed();
38-
return contract;
39-
}
15+
import { AMOUNT, createPXE, deployTokenWithMinter, expectTokenBalances, expectUintNote, setupSandbox, wad } from './utils.js';
4016

4117
describe('Token - Single PXE', () => {
4218
let pxe: PXE;

src/ts/test/utils.ts

+26
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import {
77
AccountWallet,
88
createPXEClient,
99
FieldLike,
10+
Contract,
1011
} from '@aztec/aztec.js';
1112
import { TokenContract } from '../../artifacts/Token.js';
13+
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
1214

1315
export const logger = createLogger('aztec:aztec-standards');
1416

@@ -25,6 +27,30 @@ export const setupSandbox = async () => {
2527
return createPXE();
2628
};
2729

30+
export async function deployTokenWithInitialSupply(deployer: AccountWallet) {
31+
const contract = await Contract.deploy(
32+
deployer,
33+
TokenContractArtifact,
34+
['PrivateToken', 'PT', 18, 0, deployer.getAddress()],
35+
'constructor_with_initial_supply',
36+
)
37+
.send()
38+
.deployed();
39+
return contract;
40+
}
41+
42+
export async function deployTokenWithMinter(deployer: AccountWallet) {
43+
const contract = await Contract.deploy(
44+
deployer,
45+
TokenContractArtifact,
46+
['PrivateToken', 'PT', 18, deployer.getAddress()],
47+
'constructor_with_minter',
48+
)
49+
.send()
50+
.deployed();
51+
return contract;
52+
}
53+
2854
export const expectUintNote = (note: UniqueNote, amount: bigint, owner: AztecAddress) => {
2955
expect(note.note.items[0]).toEqual(new Fr(owner.toBigInt()))
3056
expect(note.note.items[2]).toEqual(new Fr(amount))

0 commit comments

Comments
 (0)