|
|
||
|---|---|---|
| .bolt | ||
| public | ||
| puffin-calculator-iframe | ||
| src | ||
| .env | ||
| .env.example | ||
| .gitignore | ||
| Dockerfile | ||
| README.docker.md | ||
| README.md | ||
| SIMPLE-SETUP.md | ||
| app.js | ||
| docker-compose.yml | ||
| eslint.config.js | ||
| gitea-image-push.sh | ||
| index.html | ||
| nginx.conf | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.js | ||
| puffin-calculator-integrated.php | ||
| puffin-calculator-integrated.zip | ||
| puffin-calculator.css | ||
| puffin-calculator.js | ||
| setup.sh | ||
| tailwind.config.js | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
| vitest.config.ts | ||
| wordpress-integration.php | ||
README.md
Wren API Tutorial (Node.js)
This example demonstrates how to use the Wren API to:
- Fetch available offset projects
- Create a carbon offset order
Setup
- Install dependencies:
npm install
- Create a
.envfile with your Wren API token:
WREN_API_TOKEN=your-token-here
- Run the example:
npm start
API Documentation
For full API documentation, visit: https://wren.co/api
Features
- Environment variable configuration
- Error handling
- Project listing
- Order creation
- Response parsing
Sample Output
Fetching available offset projects...
Found 3 projects:
- Direct Air Carbon Capture (Iceland)
Price: $250/ton
Type: Direct Air Capture
- Coastal Mangrove Restoration (Indonesia)
Price: $150/ton
Type: Nature-Based
- Ocean Carbon Removal (Global Oceans)
Price: $200/ton
Type: Ocean-Based
Creating offset order for 1 ton of CO2...
Order created successfully!
------------------------
Order ID: ord_123abc
Amount: $200
Status: completed
Portfolio: Standard Portfolio
Portfolio projects:
- Direct Air Carbon Capture
- Coastal Mangrove Restoration