Skip to content

Commit 33216fe

Browse files
committed
readme
1 parent ff711b0 commit 33216fe

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Aave Looping TypeScript Example
2+
3+
This example demonstrates how to use the Compass Labs API SDK to perform Aave looping operations on Ethereum mainnet.
4+
5+
## Prerequisites
6+
7+
- Node.js installed
8+
- A private key for an Ethereum wallet with sufficient funds
9+
- An RPC URL for Ethereum mainnet (e.g., from Infura, Alchemy)
10+
- A Compass Labs API key
11+
12+
## Setup
13+
14+
1. Install dependencies:
15+
```bash
16+
npm install
17+
```
18+
19+
2. Create a `.env` file in the root directory with the following variables:
20+
```
21+
PRIVATE_KEY=your_private_key_here
22+
RPC_URL=your_rpc_url_here
23+
COMPASS_API_KEY=your_compass_api_key_here
24+
```
25+
26+
Make sure your private key is prefixed with "0x".
27+
28+
## Running the Example
29+
30+
Execute the TypeScript example:
31+
32+
```bash
33+
npm start
34+
```
35+
36+
## What the Example Does
37+
38+
This example:
39+
1. Initializes the Compass Labs SDK
40+
2. Sets up authorization for transaction batching
41+
3. Creates an Aave looping transaction that:
42+
- Uses USDC as collateral
43+
- Borrows WETH
44+
- Sets an initial collateral amount of 5 USDC
45+
- Uses a multiplier of 1.5x
46+
- Sets max slippage to 2.5%
47+
- Sets a loan-to-value ratio of 70%
48+
49+
## Security Note
50+
51+
Never commit your `.env` file or expose your private key. Make sure to add `.env` to your `.gitignore` file.

aave_looping/typescript_example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"build": "tsc",
9-
"start": "node dist/index.js"
9+
"start": "tsc && node dist/index.js",
10+
"dev": "ts-node --esm src/index.ts"
1011
},
1112
"keywords": [],
1213
"author": "",

0 commit comments

Comments
 (0)