|
1 | 1 | import dotenv from "dotenv";
|
| 2 | +import { join } from "path"; |
2 | 3 | dotenv.config();
|
3 | 4 |
|
4 |
| -import { seismicDevnet } from "seismic-viem"; |
| 5 | +import { createShieldedWalletClient, getShieldedContract, seismicDevnet } from "seismic-viem"; |
5 | 6 |
|
6 | 7 | import { App } from "./app";
|
7 |
| -import { BROADCAST_FILE, ABI_FILE } from "../lib/constants"; |
| 8 | +import { CONTRACT_NAME, CONTRACT_DIR } from "../lib/constants"; |
| 9 | +import { readContractAddress, readContractABI } from "../lib/utils"; |
| 10 | +import { http } from "viem"; |
| 11 | +import { anvil } from "viem/chains"; |
8 | 12 |
|
9 | 13 | async function main() {
|
10 |
| - if (!process.env.RPC_URL || !process.env.ALICE_PRIVKEY) { |
| 14 | + if (!process.env.CHAIN_ID || !process.env.RPC_URL || !process.env.PRIVKEY) { |
11 | 15 | console.error("Please set your environment variables.");
|
12 | 16 | process.exit(1);
|
13 | 17 | }
|
14 | 18 |
|
15 |
| - const app = new App({ |
16 |
| - wallet: { |
17 |
| - chain: seismicDevnet, |
18 |
| - rpcUrl: process.env.RPC_URL, |
19 |
| - privateKey: process.env.ALICE_PRIVKEY, |
20 |
| - }, |
21 |
| - contract: { |
22 |
| - abiFile: ABI_FILE, |
23 |
| - broadcastFile: BROADCAST_FILE, |
24 |
| - }, |
25 |
| - }); |
26 |
| - await app.init(); |
27 |
| - |
28 |
| - await app.reset(); |
29 |
| - await app.shake(); |
30 |
| - await app.shake(); |
31 |
| - await app.hit(); |
32 |
| - await app.shake(); |
33 |
| - await app.hit(); |
34 |
| - await app.look(); |
| 19 | + const broadcastFile = join( |
| 20 | + CONTRACT_DIR, |
| 21 | + "broadcast", |
| 22 | + `${CONTRACT_NAME}.s.sol`, |
| 23 | + process.env.CHAIN_ID, |
| 24 | + "run-latest.json", |
| 25 | + ); |
| 26 | + const abiFile = join( |
| 27 | + CONTRACT_DIR, |
| 28 | + "out", |
| 29 | + `${CONTRACT_NAME}.sol`, |
| 30 | + `${CONTRACT_NAME}.json`, |
| 31 | + ); |
| 32 | + |
| 33 | + // const walletClient = await createShieldedWalletClient({ |
| 34 | + // chain: anvil, |
| 35 | + // transport: http(process.env.RPC_URL), |
| 36 | + // privateKey: process.env.PRIVKEY as `0x${string}`, |
| 37 | + // }); |
| 38 | + // const contract = getShieldedContract({ |
| 39 | + // abi: readContractABI(abiFile), |
| 40 | + // address: readContractAddress(broadcastFile), |
| 41 | + // client: walletClient, |
| 42 | + // }); |
| 43 | + // await contract.write.reset(); |
| 44 | + // console.log("contract", contract); |
| 45 | + |
| 46 | + // const app = new App({ |
| 47 | + // wallet: { |
| 48 | + // chain: seismicDevnet, |
| 49 | + // rpcUrl: process.env.RPC_URL, |
| 50 | + // privateKey: process.env.PRIVKEY, |
| 51 | + // }, |
| 52 | + // contract: { |
| 53 | + // abi: readContractABI(abiFile), |
| 54 | + // address: readContractAddress(broadcastFile), |
| 55 | + // }, |
| 56 | + // }); |
| 57 | + // await app.init(); |
| 58 | + |
| 59 | + // await app.reset(); |
| 60 | + // await app.shake(); |
| 61 | + // await app.shake(); |
| 62 | + // await app.hit(); |
| 63 | + // await app.shake(); |
| 64 | + // await app.hit(); |
| 65 | + // await app.look(); |
35 | 66 | }
|
36 | 67 |
|
37 | 68 | main();
|
0 commit comments