Skip to content

Commit dc39cfe

Browse files
committed
chore: reframe deployed envs and scaffold client readme file
1 parent b4690ec commit dc39cfe

File tree

5 files changed

+44
-26
lines changed

5 files changed

+44
-26
lines changed

packages/client/README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
11
# `@aave/client`
22

3-
The official JavaScript client for the Aave API.
3+
The official TypeScript library for interacting with Aave Protocol.
44

55
---
66

7-
This package enables you to interact with the Aave API via a type safe interface that abstracts away some of the GraphQL intricacies.
7+
8+
The `@aave/client` package contains the core functionality to query markets, execute transactions, and manage user positions across Aave lending markets and vaults. It provides a type-safe interface with built-in error handling and result types.
9+
10+
11+
## Usage
12+
13+
```typescript
14+
import { AaveClient, evmAddress, chainId } from '@aave/client';
15+
import { supply, userSupplies } from '@aave/client/actions';
16+
import { sendWith } from '@aave/client/viem';
17+
18+
// Create client
19+
const client = new AaveClient({
20+
environment: mainnet,
21+
});
22+
23+
// Query user positions
24+
const positions = await userSupplies(client, {
25+
markets: [evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2')],
26+
user: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),
27+
});
28+
29+
// Execute transactions
30+
const result = await supply(client, {
31+
market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
32+
amount: {
33+
erc20: {
34+
currency: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),
35+
value: '1000'
36+
}
37+
},
38+
supplier: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),
39+
chainId: chainId(1),
40+
}).andThen(sendWith(wallet));
41+
```

packages/client/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class AaveClient {
5252
*
5353
* ```ts
5454
* const client = AaveClient.create({
55-
* environment: mainnet,
55+
* environment: production,
5656
* origin: 'http://example.com',
5757
* });
5858
* ```

packages/client/src/test-utils.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference path="../../../vite-env.d.ts" />
22

3-
import { local, staging, testnet } from '@aave/env';
3+
import { local, staging } from '@aave/env';
44
import type { AnyVariables } from '@aave/graphql';
55
import { schema } from '@aave/graphql/test-utils';
66
import type { TypedDocumentNode } from '@urql/core';
@@ -15,11 +15,7 @@ import { GraphQLErrorCode } from './errors';
1515

1616
export const signer = privateKeyToAccount(import.meta.env.PRIVATE_KEY);
1717
export const environment =
18-
import.meta.env.ENVIRONMENT === 'local'
19-
? local
20-
: import.meta.env.ENVIRONMENT === 'staging'
21-
? staging
22-
: testnet;
18+
import.meta.env.ENVIRONMENT === 'local' ? local : staging;
2319

2420
export const client = AaveClient.create({
2521
environment,

packages/env/src/index.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,13 @@ export type EnvironmentConfig = {
99
};
1010

1111
/**
12-
* The mainnet environment configuration.
12+
* The production environment configuration.
1313
*/
14-
export const mainnet: EnvironmentConfig = new Proxy<EnvironmentConfig>(
14+
export const production: EnvironmentConfig = new Proxy<EnvironmentConfig>(
1515
{} as EnvironmentConfig,
1616
{
1717
get: () => {
18-
never(`The 'mainnet' environment is not available (yet)`);
19-
},
20-
},
21-
);
22-
23-
/**
24-
* The testnet environment configuration.
25-
*/
26-
export const testnet: EnvironmentConfig = new Proxy<EnvironmentConfig>(
27-
{} as EnvironmentConfig,
28-
{
29-
get: () => {
30-
never(`The 'testnet' environment is not available (yet)`);
18+
never(`The 'production' environment is not available (yet)`);
3119
},
3220
},
3321
);

packages/react/src/AaveProvider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export type AaveProviderProps = {
2222
* Manages the internal state of the Aave SDK.
2323
*
2424
* ```tsx
25-
* import { AaveProvider, AaveClient, mainnet } from '@aave/react';
25+
* import { AaveProvider, AaveClient, production } from '@aave/react';
2626
*
2727
* const client = AaveClient.create({
28-
* environment: mainnet,
28+
* environment: production,
2929
* });
3030
*
3131
* function App() {

0 commit comments

Comments
 (0)