{"id":45863882,"url":"https://github.com/tetherto/wdk-protocol-lending-aave-evm","last_synced_at":"2026-02-27T07:32:37.982Z","repository":{"id":323365118,"uuid":"1028387956","full_name":"tetherto/wdk-protocol-lending-aave-evm","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-19T17:08:37.000Z","size":814,"stargazers_count":0,"open_issues_count":1,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-19T23:18:38.317Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tetherto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-29T13:05:57.000Z","updated_at":"2025-11-12T15:57:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/wdk-protocol-lending-aave-evm","commit_stats":null,"previous_names":["tetherto/wdk-protocol-lending-aave-evm"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/wdk-protocol-lending-aave-evm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-lending-aave-evm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-lending-aave-evm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-lending-aave-evm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-lending-aave-evm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/wdk-protocol-lending-aave-evm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-lending-aave-evm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29887537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T05:38:26.446Z","status":"ssl_error","status_checked_at":"2026-02-27T05:38:25.235Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-27T07:32:37.237Z","updated_at":"2026-02-27T07:32:37.977Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @tetherto/wdk-protocol-lending-aave-evm\n\nNote: This package is in beta. Please test in a dev setup first.\n\nA simple way to use Aave V3 lending with EVM wallet accounts. You can add and take out tokens, borrow, pay back, and read your account data. It works with normal EVM accounts and ERC-4337 smart accounts.\n\n## 🔍 About WDK\n\nThis is part of WDK (Wallet Development Kit). WDK helps you build safe, non‑custody wallets. Read more at https://docs.wallet.tether.io.\n\n## 🌟 Features\n\n- Supply (add tokens to the pool)\n- Withdraw (take tokens from the pool)\n- Borrow\n- Repay\n- Get account data (collateral, debt, health)\n- Quote costs before you send\n- Works with normal EVM and ERC‑4337 accounts\n\n## ⬇️ Installation\n\n```bash\nnpm install @tetherto/wdk-protocol-lending-aave-evm\n```\n\n## 🚀 Quick Start\n\n### Use with a normal EVM account\n\n```javascript\nimport AaveProtocolEvm from '@tetherto/wdk-protocol-lending-aave-evm'\nimport { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'\n\nconst seed = 'your twelve word seed goes here'\n\n// Create account at path m/44'/60'/0'/0/0\nconst account = new WalletAccountEvm(seed, \"0'/0/0\", {\n  provider: 'https://ethereum-rpc.publicnode.com'\n})\n\n// Create protocol\nconst aave = new AaveProtocolEvm(account)\n\n// Supply\nawait aave.supply({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n\n// Withdraw\nawait aave.withdraw({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n\n// Borrow\nawait aave.borrow({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n\n// Repay\nawait aave.repay({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n\n// Get account data\nconst data = await aave.getAccountData()\n```\n\n### Get quotes first\n\n```javascript\n// Supply quote\nconst supplyQuote = await aave.quoteSupply({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n\n// Withdraw quote\nconst withdrawQuote = await aave.quoteWithdraw({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n\n// Borrow quote\nconst borrowQuote = await aave.quoteBorrow({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n\n// Repay quote\nconst repayQuote = await aave.quoteRepay({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\n### Use with an ERC‑4337 smart account\n\n```javascript\nimport AaveProtocolEvm from '@tetherto/wdk-protocol-lending-aave-evm'\nimport { WalletAccountEvmErc4337 } from '@tetherto/wdk-wallet-evm-erc-4337'\n\nconst smart = new WalletAccountEvmErc4337(seed, \"0'/0/0\", {\n  provider: 'https://arb1.arbitrum.io/rpc',\n  bundlerUrl: 'YOUR_BUNDLER',\n  paymasterUrl: 'YOUR_PAYMASTER'\n})\n\nconst aave4337 = new AaveProtocolEvm(smart)\n\n// Supply with smart account\nconst result = await aave4337.supply({ token: 'TOKEN_ADDRESS', amount: 1000000n }, {\n  paymasterToken: 'USDT'\n})\n```\n\n## 📚 API Reference\n\n### AaveProtocolEvm\n\nMain class for Aave V3 lending on EVM.\n\n#### Constructor\n\n```javascript\nnew AaveProtocolEvm(account)\n```\n\nParameters:\n- `account` (WalletAccountEvm | WalletAccountEvmErc4337 | WalletAccountReadOnlyEvm | WalletAccountReadOnlyEvmErc4337)\n\nExample:\n\n```javascript\nconst aave = new AaveProtocolEvm(account)\n```\n\n### Methods\n\n| Method | Description | Returns |\n|--------|-------------|---------|\n| `supply(options, config?)` | Add tokens to the pool | `Promise\u003c{hash: string, fee: bigint, ...}\u003e` |\n| `quoteSupply(options, config?)` | Get cost to add tokens | `Promise\u003c{fee: bigint}\u003e` |\n| `withdraw(options, config?)` | Take tokens from the pool | `Promise\u003c{hash: string, fee: bigint}\u003e` |\n| `quoteWithdraw(options, config?)` | Get cost to take tokens | `Promise\u003c{fee: bigint}\u003e` |\n| `borrow(options, config?)` | Borrow tokens from the pool | `Promise\u003c{hash: string, fee: bigint}\u003e` |\n| `quoteBorrow(options, config?)` | Get cost to borrow | `Promise\u003c{fee: bigint}\u003e` |\n| `repay(options, config?)` | Pay back what you borrowed | `Promise\u003c{hash: string, fee: bigint}\u003e` |\n| `quoteRepay(options, config?)` | Get cost to pay back | `Promise\u003c{fee: bigint}\u003e` |\n| `setUseReserveAsCollateral(token, use, config?)` | Turn use as collateral on or off | `Promise\u003c{hash: string, fee: bigint}\u003e` |\n| `setUserEMode(categoryId, config?)` | Set eMode for the user | `Promise\u003c{hash: string, fee: bigint}\u003e` |\n| `getAccountData(account?)` | Read account stats | `Promise\u003c{...}\u003e` |\n\n#### `supply(options, config?)`\nAdd tokens to the pool.\n\nOptions:\n- `token` (string): token address\n- `amount` (bigint): amount in base unit\n- `onBehalfOf` (string, optional)\n\nExample:\n\n```javascript\nconst result = await aave.supply({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\nNotes:\n- Normal account: may return `approveHash` and `resetAllowanceHash` (for USDT on main net).\n- ERC‑4337 account: approve steps are bundled; only `hash` and `fee` are returned.\n\n#### `quoteSupply(options, config?)`\nGet the fee to add tokens.\n\n```javascript\nconst quote = await aave.quoteSupply({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\n#### `withdraw(options, config?)`\nTake tokens from the pool.\n\nOptions:\n- `token` (string)\n- `amount` (bigint)\n- `to` (string, optional)\n\n```javascript\nconst tx = await aave.withdraw({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\n#### `quoteWithdraw(options, config?)`\nGet the fee to take tokens.\n\n```javascript\nconst quote = await aave.quoteWithdraw({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\n#### `borrow(options, config?)`\nBorrow tokens from the pool.\n\nOptions:\n- `token` (string)\n- `amount` (bigint)\n- `onBehalfOf` (string, optional)\n\n```javascript\nconst tx = await aave.borrow({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\n#### `quoteBorrow(options, config?)`\nGet the fee to borrow.\n\n```javascript\nconst quote = await aave.quoteBorrow({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\n#### `repay(options, config?)`\nPay back what you borrowed.\n\nOptions:\n- `token` (string)\n- `amount` (bigint)\n- `onBehalfOf` (string, optional)\n\n```javascript\nconst tx = await aave.repay({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\nNotes:\n- Normal account: may return `approveHash` and `resetAllowanceHash` (USDT on main net).\n- ERC‑4337 account: approve steps are bundled; only `hash` and `fee` are returned.\n\n#### `quoteRepay(options, config?)`\nGet the fee to pay back.\n\n```javascript\nconst quote = await aave.quoteRepay({ token: 'TOKEN_ADDRESS', amount: 1000000n })\n```\n\n#### `setUseReserveAsCollateral(token, use, config?)`\nTurn use as collateral on or off for a token.\n\n```javascript\nconst tx = await aave.setUseReserveAsCollateral('TOKEN_ADDRESS', true)\n```\n\n#### `setUserEMode(categoryId, config?)`\nSet eMode for the user.\n\n```javascript\nconst tx = await aave.setUserEMode(1)\n```\n\n#### `getAccountData(account?)`\nRead account stats like total collateral, debt, and health.\n\n```javascript\nconst data = await aave.getAccountData()\n```\n\nReturns:\n```javascript\n{\n  totalCollateralBase: bigint,\n  totalDebtBase: bigint,\n  availableBorrowsBase: bigint,\n  currentLiquidationThreshold: bigint,\n  ltv: bigint,\n  healthFactor: bigint\n}\n```\n\n#### Config (ERC‑4337 only)\n- `paymasterToken` (string): token to pay gas.\n\n#### Rules\n- `token` must be a valid address (not zero address).\n- `amount` must be greater than 0.\n- `onBehalfOf` and `to` (if set) must be valid and not zero address.\n- A provider is needed to read and send txs.\n- For USDT on main net, allowance may be set to 0 first, then set again.\n\nNotes:\n- `amount` is in the token base unit (use BigInt like `1000000n`).\n- For USDT on the main net, the code may first set the allowance to `0` and then set it again.\n\n## 🌐 Supported Networks\n\nWorks on Aave V3 chains. You need a working RPC and the right token address.\n\nSupported chains:\n- Ethereum\n- Arbitrum\n- Base\n- Optimism\n- Polygon\n- Avalanche\n- BNB\n- Celo\n- Gnosis\n- Linea\n- Scroll\n- Soneium\n- Sonic\n- ZkSync\n- Metis\n\n## 🔒 Security Considerations\n\n- Keep your seed safe. Do not share it.\n- Check token and address values before you send.\n- Get a quote first to see cost.\n- Make sure the pool for the token is active and not frozen.\n\n## 🛠️ Development\n\n### Building\n\n```bash\n# Install dependencies\nnpm install\n\n# Build TypeScript definitions\nnpm run build:types\n\n# Lint code\nnpm run lint\n\n# Fix linting issues\nnpm run lint:fix\n```\n\n### Testing\n\n```bash\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n```\n\n## 📜 License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 🆘 Support\n\nFor support, please open an issue on the GitHub repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-protocol-lending-aave-evm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fwdk-protocol-lending-aave-evm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-protocol-lending-aave-evm/lists"}