Files
viem/README.md
2026-02-12 00:47:15 +01:00

55 lines
829 B
Markdown

# Viem Lecture
This project uses [viem](https://viem.sh/) for TypeScript/JavaScript Ethereum interactions.
## Getting started
```bash
npm install
```
## Writing scripts
Put your scripts in the **`scripts/`** directory.
To run a script:
```bash
# If you have a newer version of Node
node scripts/your-script.ts
# TypeScript (using tsx)
npx tsx scripts/your-script.ts
```
## Environment variables
To read variables from a `.env` file when running a script:
```bash
node --env-file=.env scripts/your-script.ts
```
The script will have access to all variables defined in `.env` via `process.env.VARIABLE_NAME`.
## Prompts
To read user input from the console, you can use the prompts library:
```js
const { name } = await prompts([{
name: 'name',
type: 'text',
message: 'Enter your name: '
}])
```