File tree Expand file tree Collapse file tree
aave_looping/typescript_example Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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.
Original file line number Diff line number Diff line change 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" : " " ,
You can’t perform that action at this time.
0 commit comments